Skip to content

Conversation

@VeckoTheGecko
Copy link
Contributor

@VeckoTheGecko VeckoTheGecko commented Dec 5, 2025

This PR is incremental work fixing typechecking errors in parcels using Parcels. Besides fixing mypy errors, we have the following changes:

  • Remove unused functions c5a467f
  • Define CfAxes in parcels._typing
  • Update mypy config with ignored errors. Will incrementally work towards better and better coverage.

I have enabled the typechecking in CI - it isn't passing yet, but I will be working in future PRs to reduce the number of errors. This workflow can also be run using pixi run typing .

@VeckoTheGecko VeckoTheGecko marked this pull request as ready for review January 20, 2026 12:51
Comment on lines +459 to +468
def _ds_rename_using_standard_names(ds: xr.Dataset | ux.UxDataset, name_dict: dict[str, str]) -> xr.Dataset:
for standard_name, rename_to in name_dict.items():
name = ds.cf[standard_name].name
ds = ds.rename({name: rename_to})
logger.info(
f"cf_xarray found variable {name!r} with CF standard name {standard_name!r} in dataset, renamed it to {rename_to!r} for Parcels simulation."
)
return ds


Copy link
Member

Choose a reason for hiding this comment

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

Should calling this function not be part of convert?

Once a user requests a FieldSet, do we really want to still change field names? There would be no way to override that for a user anymore.

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'm only moving these here since its only use is in the ux fieldset ingestion - and that hasn't yet moved to convert. I'm happy either way (I thought having it here with the other functionality was neater, especially since we're probably going to outright drop this functionality due to us not doing U and V discovery in convert.py)

Copy link
Member

Choose a reason for hiding this comment

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

OK, clear. Then perhaps add a TODO that we will likely drop this function in the near future?

Comment on lines +174 to +175
assert xi is not None
assert yi is not None
Copy link
Member

Choose a reason for hiding this comment

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

For my own understanding; why are these new lines needed?

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants