Skip to content

Conversation

@VeckoTheGecko
Copy link
Contributor

This PR supercedes #2447
implementing the following additional functionality:

  • Refactor out the FieldSet.from_nemo() functionality into a convert.py module with a nemo_to_sgrid() function. Also added corresponding tests.
  • Make the input parameters of the nemo_to_sgrid function more closely align with the input datasets
  • Update FieldSet.from_sgrid_conventions to infer mesh from the metadata included in the dataset
  • Add get_value_by_id() function to Grid*DMetadata classes allowing to easily refer to parts of the SGRID metadata model

Future work:

  • Improve logging and metadata conversion convert.py - its important that we refactor this module so that its clearer, and have logging so that changes to the input dataset are communicated to the user. To support this, we need
  • Better testing against different NEMO datasets
    • Reach out to the NEMO community asking for ncdump output so that better see the types of nemo models out there

I'll make an issue to track this future work.

erikvansebille and others added 28 commits January 9, 2026 16:24
And update of tutorial_nemo_curvilinear
And updating tutorial
ANd expading comments on loading in the dataset
To use same ordering as in XLinear
This requires smaller selection_dict for the isel, so hopefully faster code
And also separating offset calculation into its own helper function
It's not clear why this is here, nor why removing it causes a test failure. To be investigated another time.

EDIT: This was introduced in
Parcels-code@c311fba
- though we're investigating if this can be implemented another way
  since there should be no particular difference with NEMO
Gradually reducing the dependency on the `mesh` param
Updates the API for conversion to be more closely aligned with the input data. Also handles the U and V fields separately - correctly assigning the dimension naming before merging into a single dataset.
Avoid assuming there's a U and V field. Maybe this should be refactored later...
VeckoTheGecko and others added 3 commits January 12, 2026 10:45
Avoiding a FutureWarning: The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
@VeckoTheGecko

This comment was marked as outdated.

@VeckoTheGecko
Copy link
Contributor Author

I'm getting failures in the unit tests due to 26c6d55 , how should we go about choosing the interpolators @erikvansebille (and is this blocked by #2461 ? Should we fix this in a sepatare PR?)

Fixed in f726363

@VeckoTheGecko
Copy link
Contributor Author

I'm happy with the state of this - happy to merge and iterate in future PRs. @erikvansebille let me know if you have more feedback before merging.

@VeckoTheGecko VeckoTheGecko enabled auto-merge (squash) January 14, 2026 08:25
@VeckoTheGecko VeckoTheGecko merged commit 19b6259 into Parcels-code:v4-dev Jan 14, 2026
9 of 10 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Parcels development Jan 14, 2026
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.

2 participants