Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Exploration]: Including dataarrays with our current dataset API model (#671 discussion) #725

Open
tomvothecoder opened this issue Jan 23, 2025 · 2 comments · May be fixed by #737
Open
Labels
project: seats-fy25 A goal for SEATS FY25 type: enhancement New enhancement request

Comments

@tomvothecoder
Copy link
Collaborator

tomvothecoder commented Jan 23, 2025

Is your feature request related to a problem?

Refer to #671

This GitHub issue was just opened for tracking on the board project.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

@pochedls
Copy link
Collaborator

pochedls commented Feb 1, 2025

Using the spatial functionality, I started an example of how we might approach this goal with a new branch.

import xcdat as xc
fn = '/p/css03/esgf_publish/CMIP6/CMIP/MIROC/MIROC-ES2L/historical/r6i1p1f2/Amon/tas/gn/v20200318/tas_Amon_MIROC-ES2L_historical_r6i1p1f2_gn_185001-201412.nc'
ds = xc.open_mfdataset(fn)
tas = ds('tas')
tas.spatial.average()

<xarray.DataArray 'tas' (time: 1980)> Size: 16kB
dask.array<truediv, shape=(1980,), dtype=float64, chunksize=(1,), chunktype=numpy.ndarray>
Coordinates:

  • time (time) object 16kB 1850-01-16 12:00:00 ... 2014-12-16 12:00:00
    Attributes:
    standard_name: air_temperature
    long_name: Near-Surface Air Temperature
    comment: near-surface (usually, 2 meter) air temperature
    units: K
    original_name: T2
    cell_methods: area: time: mean
    cell_measures: area: areacella
    history: 2019-12-27T22:22:52Z altered by CMOR: Treated scalar dime...

@tomvothecoder
Copy link
Collaborator Author

Using the spatial functionality, I started an example of how we might approach this goal with a new branch.

import xcdat as xc
fn = '/p/css03/esgf_publish/CMIP6/CMIP/MIROC/MIROC-ES2L/historical/r6i1p1f2/Amon/tas/gn/v20200318/tas_Amon_MIROC-ES2L_historical_r6i1p1f2_gn_185001-201412.nc'
ds = xc.open_mfdataset(fn)
tas = ds('tas')
tas.spatial.average()

<xarray.DataArray 'tas' (time: 1980)> Size: 16kB
dask.array<truediv, shape=(1980,), dtype=float64, chunksize=(1,), chunktype=numpy.ndarray>
Coordinates:

  • time (time) object 16kB 1850-01-16 12:00:00 ... 2014-12-16 12:00:00
    Attributes:
    standard_name: air_temperature
    long_name: Near-Surface Air Temperature
    comment: near-surface (usually, 2 meter) air temperature
    units: K
    original_name: T2
    cell_methods: area: time: mean
    cell_measures: area: areacella
    history: 2019-12-27T22:22:52Z altered by CMOR: Treated scalar dime...

This is awesome! I'll take a closer look soon. Happy to see you got a working prototype.

@pochedls pochedls linked a pull request Feb 12, 2025 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: seats-fy25 A goal for SEATS FY25 type: enhancement New enhancement request
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants