Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonise dimension order in Field.data and Kernel.interpolate #276

Closed
erikvansebille opened this issue Jan 24, 2018 · 1 comment
Closed

Comments

@erikvansebille
Copy link
Member

At present, Field.data is in (time, depth, lat, lon) format, but Field interpolation in Kernels is in [time, lon, lat, depth]. That of course is needlessly confusing to users. We should harmonise/standardise this

If/when Parcels move to xarray and Dask (#216), we should carefully rethink in which order we assume the dimensions of Fields to be, also depending on what the most efficient way is for I/O.

Finally, this could also be an opportunity to remove the transposing that is currently done in Fields.from_netcdf()

erikvansebille added a commit that referenced this issue Jun 13, 2018
This addresses #276 by harmonising the order of dimensions in
Field.data and in Field.eval()
@erikvansebille
Copy link
Member Author

The harmonisation of dimension order in Field.data and Kernel.interpolate has now been implemented in #503.

Note that, if you're therefore updating the Parcels code, you should also update your kernels!

That is because the syntax for Field interpolation has changed from the old (time, lon, lat, depth) to the new (time, depth, lat, lon) order.

In order to help you realise that Kernel interpolation syntax has changed, we have also changed the way Kernels are defined. The dt argument in Kernel definition is now gone; use the particle.dt attribute if you need access to the integration timestep.

You will get an error if you run your old Kernels with the latest version of Parcels, which prompts you to update your code:

AssertionError: Since Parcels v2.0, kernels do only take 3 arguments: particle, fieldset, time 
!! AND !! 
Argument order in field interpolation is time, depth, lat, lon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant