Skip to content

Commit dc3aec1

Browse files
Add docstring for FieldSet.from_copernicusmarine()
1 parent 019cb99 commit dc3aec1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

parcels/fieldset.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,27 @@ def gridset(self) -> list[BaseGrid]:
178178
return grids
179179

180180
def from_copernicusmarine(ds: xr.Dataset):
181+
"""Create a FieldSet from a Copernicus Marine Service xarray.Dataset.
182+
183+
Parameters
184+
----------
185+
ds : xarray.Dataset
186+
xarray.Dataset as obtained from the copernicusmarine toolbox.
187+
188+
Returns
189+
-------
190+
FieldSet
191+
FieldSet object containing the fields from the dataset that can be used for a Parcels simulation.
192+
193+
Notes
194+
-----
195+
See https://help.marine.copernicus.eu/en/collections/9080063-copernicus-marine-toolbox for more information on the copernicusmarine toolbox.
196+
The toolbox to ingest data from most of the products on the Copernicus Marine Service (https://data.marine.copernicus.eu/products) into an xarray.Dataset.
197+
You can use indexing and slicing to select a subset of the data before passing it to this function.
198+
Note that most Parcels uses will require both U and V fields to be present in the dataset. This function will try to find out which variables in the dataset correspond to U and V.
199+
To override the automatic detection, rename the appropriate variables in your dataset to 'U' and 'V' before passing it to this function.
200+
201+
"""
181202
ds = ds.copy()
182203
ds = _discover_copernicusmarine_U_and_V(ds)
183204
expected_axes = set("XYZT") # TODO: Update after we have support for 2D spatial fields

0 commit comments

Comments
 (0)