Skip to content

Commit ba5b285

Browse files
committed
Add doc
1 parent 8babb9a commit ba5b285

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

docs/inference/configs/inputs.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,39 @@ You can specify the input as ``grib`` to read the data from a GRIB file.
5151

5252
For more options, see :ref:`grib-input`.
5353

54+
********
55+
netcdf
56+
********
57+
58+
You can specify the input as ``netcdf`` to read the data from a NetCDF
59+
file.
60+
61+
.. literalinclude:: yaml/inputs_5.yaml
62+
:language: yaml
63+
64+
.. note::
65+
66+
The netcdf input expects the data to be stored identically to the
67+
GRIB input, i.e. with a values coordinate, and variable names that
68+
match what the checkpoint was trained on.
69+
70+
For context, using ``earthkit-data`` a grib file can be exported as
71+
netcdf with the following and then read back in using the netcdf
72+
input, note how the names are created:
73+
74+
.. code:: python
75+
76+
import earthkit.data as ekd
77+
78+
ds = ekd.from_source("file", "input.grib")
79+
80+
ds_xr = ds.to_xarray(
81+
variable_key="p_l",
82+
remapping={"p_l": "{param}_{levelist}"},
83+
add_earthkit_attrs=False,
84+
)
85+
ds_xr.to_netcdf("input.nc")
86+
5487
******
5588
mars
5689
******
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
input:
2+
netcdf: /path/to/netcdf/file.nc

0 commit comments

Comments
 (0)