OceanParcels / Parcels

Main code for Parcels (Probably A Really Computationally Efficient Lagrangian Simulator)
https://www.oceanparcels.org
MIT License
295 stars 136 forks source link

Fieldsets from multiple nc's with different resolutions #806

Closed weathermanbarnes closed 4 years ago

weathermanbarnes commented 4 years ago

Good day.

Is is possible to combine multiple fieldsets (different variables) from multiple netcdf files with different resolutions into a single fieldset? I currently have to pre-process the data to the same grid reolsution but this degrades the data. Is there an example that does this? What is the best approach?

Thanks, Michael

erikvansebille commented 4 years ago

Yes, that is possible. See e.g. the code for our recent GRL paper at https://github.com/OceanParcels/PumiceEvent (combining CMEMS currents, WaveWatch III waves and winds).

Or see the slightly more complicated tutorial on summed Fields

weathermanbarnes commented 4 years ago

Hi Erik.

Thanks so much for the above examples. They were exactly what I needed. I am now looking to ingest two sets of data from netcdfs into a parcels run, however they both have different definitions of longitude (ie. -180 -> 180 and 0 -> 360). This means that in the 0 to 360 grid, particles with a longitude of <0 are out of bounds. I see that the code autoflips the data in the North-South direction. I was wondering, are there any tools in parcels that will allow me to redefine the longitude grid from 0 -> 360 to -180 -> 180?

Thanks again for your assistance. Michael

erikvansebille commented 4 years ago

Hi @weathermanbarnes

I had the same issue with different longitude definitions for our paper about Tropical Pacific FADs, and what I did then is create a new kernel that samples the '-180 to 180' field in a different wau, see https://github.com/OceanParcels/SKIM_dFADtracking/blob/master/fadset_run.py#L19-L30. I couldn't find a way to do this within Parcels automatically, so I guess your best bet is to create your own custom kernels too