Skip to content

Conversation

@VeckoTheGecko
Copy link
Contributor

@VeckoTheGecko VeckoTheGecko commented Sep 23, 2025

Also fixes #2222

Here I have only added testing on the FieldSet construction (not running any advection)

@VeckoTheGecko VeckoTheGecko marked this pull request as draft September 23, 2025 12:43
@VeckoTheGecko VeckoTheGecko changed the title Add FieldSet.from_copernicusmarine Add FieldSet.from_copernicusmarine Sep 23, 2025
@VeckoTheGecko VeckoTheGecko marked this pull request as ready for review September 23, 2025 14:54

ds = _rename_coords_copernicusmarine(ds)
grid = XGrid(
xgcm.Grid(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get a lot of warnings

  /Users/erik/anaconda3/envs/parcels-v4/lib/python3.12/site-packages/xgcm/grid.py:196: DeprecationWarning: The `periodic` argument will be deprecated. To preserve previous behavior supply `boundary = 'periodic'.

Should we fix these here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get a lot of warnings

  /Users/erik/anaconda3/envs/parcels-v4/lib/python3.12/site-packages/xgcm/grid.py:196: DeprecationWarning: The `periodic` argument will be deprecated. To preserve previous behavior supply `boundary = 'periodic'.

Should we fix these here?

Investigating, but not sure how simple this is (might be upstream) - but merging for now so others can easily test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be upstream

Indeed upstream - we can't really get around the warnings xgcm/xgcm#678 .

@erikvansebille
Copy link
Member

Just realise: we should also add W parsing, for vertical velocity. Some products (but not all) have them. For example, in https://data.marine.copernicus.eu/product/GLOBAL_ANALYSISFORECAST_PHY_001_024/description it's called Upward sea water velocity

@VeckoTheGecko
Copy link
Contributor Author

Just realise: we should also add W parsing

I'll deal with this separately next. Merging for now so people can test with horizontal velocities

@VeckoTheGecko VeckoTheGecko merged commit 97cd0c3 into Parcels-code:v4-dev Sep 24, 2025
9 checks passed
@VeckoTheGecko VeckoTheGecko deleted the copernicusmarine branch September 24, 2025 13:26
@github-project-automation github-project-automation bot moved this from Backlog to Done in Parcels development Sep 24, 2025
@VeckoTheGecko
Copy link
Contributor Author

Just realise: we should also add W parsing, for vertical velocity. Some products (but not all) have them. For example, in data.marine.copernicus.eu/product/GLOBAL_ANALYSISFORECAST_PHY_001_024/description it's called Upward sea water velocity

Looks like the vertical velocities for this product here are stored in a different dataset ID with name "Vertical currents, *" - not sure if there are copernicus datasets that ship U V and W together. Either way, I'll add parsing for standard name upward_sea_water_velocity

>>> copernicusmarine.open_dataset('cmems_mod_glo_phy-cur_anfc_0.083deg_P1M-m')
INFO - 2025-09-25T10:57:20Z - Selected dataset version: "202406"
INFO - 2025-09-25T10:57:20Z - Selected dataset part: "default"
<xarray.Dataset> Size: 138GB
Dimensions:    (depth: 50, latitude: 2041, longitude: 4320, time: 39)
Coordinates:
  * depth      (depth) float32 200B 0.494 1.541 2.646 ... 5.275e+03 5.728e+03
  * latitude   (latitude) float32 8kB -80.0 -79.92 -79.83 ... 89.83 89.92 90.0
  * longitude  (longitude) float32 17kB -180.0 -179.9 -179.8 ... 179.8 179.9
  * time       (time) datetime64[ns] 312B 2022-06-01 2022-07-01 ... 2025-08-01
Data variables:
    uo         (time, depth, latitude, longitude) float32 69GB dask.array<chunksize=(2, 50, 512, 2048), meta=np.ndarray>
    vo         (time, depth, latitude, longitude) float32 69GB dask.array<chunksize=(2, 50, 512, 2048), meta=np.ndarray>
Attributes:
    Conventions:  CF-1.6
    references:   http://marine.copernicus.eu
    institution:  Mercator Ocean
    credit:       E.U. Copernicus Marine Service Information (CMEMS)
    source:       MERCATOR GLO12
    producer:     CMEMS - Global Monitoring and Forecasting Centre
    contact:      servicedesk.cmems@mercator-ocean.eu
    title:        Monthly mean fields for product GLOBAL_ANALYSISFORECAST_PHY...
>>> copernicusmarine.open_dataset('cmems_mod_glo_phy-wcur_anfc_0.083deg_P1D-m')
INFO - 2025-09-25T10:58:47Z - Selected dataset version: "202406"
INFO - 2025-09-25T10:58:47Z - Selected dataset part: "default"
<xarray.Dataset> Size: 2TB
Dimensions:    (depth: 50, latitude: 2041, longitude: 4320, time: 1222)
Coordinates:
  * depth      (depth) float32 200B 0.494 1.541 2.646 ... 5.275e+03 5.728e+03
  * latitude   (latitude) float32 8kB -80.0 -79.92 -79.83 ... 89.83 89.92 90.0
  * longitude  (longitude) float32 17kB -180.0 -179.9 -179.8 ... 179.8 179.9
  * time       (time) datetime64[ns] 10kB 2022-06-01 2022-06-02 ... 2025-10-04
Data variables:
    wo         (time, depth, latitude, longitude) float32 2TB dask.array<chunksize=(50, 2, 512, 2048), meta=np.ndarray>
Attributes:
    Conventions:  CF-1.8
    references:   http://marine.copernicus.eu
    institution:  Mercator Ocean International
    credit:       E.U. Copernicus Marine Service Information (CMEMS)
    source:       MOI GLO12
    producer:     CMEMS - Global Monitoring and Forecasting Centre
    contact:      https://marine.copernicus.eu/contact
    title:        daily mean fields from Global Ocean Physics Analysis and Fo...
>>> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add cf_xarray as dependency

2 participants