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

Fix broken code-blocks in rst files #377

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions ADVANCED_USAGE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,43 @@ or they can be passed directly to *Xarray*.

The simplest *Fieldset* is a list of dictionaries:

.. code-block: python

>>> import xarray as xr
>>> fieldset = [
... {
... "gridType": "regular_ll",
... "Nx": 2,
... "Ny": 3,
... "distinctLatitudes": [-10.0, 0.0, 10.0],
... "distinctLongitudes": [0.0, 10.0],
... "paramId": 130,
... "shortName": "t",
... "values": [[1, 2], [3, 4], [5, 6]],
... "dataDate": 20211216,
... "dataTime": 1200,
... }
... ]
>>> ds = xr.open_dataset(fieldset, engine="cfgrib")
>>> ds
<xarray.Dataset>
Dimensions: (latitude: 3, longitude: 2)
Coordinates:
time datetime64[ns] ...
* latitude (latitude) float64 -10.0 0.0 10.0
* longitude (longitude) float64 0.0 10.0
Data variables:
t (latitude, longitude) float32 ...
Attributes:
Conventions: CF-1.7
history: ...
>>> ds.mean()
<xarray.Dataset>
Dimensions: ()
Coordinates:
time datetime64[ns] ...
Data variables:
t float32 3.5
.. code-block:: python

>>> import xarray as xr
>>> fieldset = [
... {
... "gridType": "regular_ll",
... "Nx": 2,
... "Ny": 3,
... "distinctLatitudes": [-10.0, 0.0, 10.0],
... "distinctLongitudes": [0.0, 10.0],
... "paramId": 130,
... "shortName": "t",
... "values": [[1, 2], [3, 4], [5, 6]],
... "dataDate": 20211216,
... "dataTime": 1200,
... }
... ]
>>> ds = xr.open_dataset(fieldset, engine="cfgrib")
>>> ds
<xarray.Dataset>
Dimensions: (latitude: 3, longitude: 2)
Coordinates:
time datetime64[ns] ...
* latitude (latitude) float64 -10.0 0.0 10.0
* longitude (longitude) float64 0.0 10.0
Data variables:
t (latitude, longitude) float32 ...
Attributes:
Conventions: CF-1.7
history: ...
>>> ds.mean()
<xarray.Dataset>
Dimensions: ()
Coordinates:
time datetime64[ns] ...
Data variables:
t float32 3.5


For example you can implement a dedicated ``Fieldset`` class following this pattern:
Expand Down
Loading
Loading