OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
249 stars 121 forks source link

Use of cycle_length in an (CROCO) NetCDF file? #903

Open AndresSepulveda opened 2 years ago

AndresSepulveda commented 2 years ago

Hi,

I want to use climatological results from a CROCO simulation. I have 12 months of currents but if I release particles on December 31st they will have no information for the currents.

In CROCO the attribute cycle_length (for U, V, T, S, etc) can be used to read again results from month 01, year 01 to force month 01 of year 02.

Does something similar can be used in OpenDrift?

I've been adding some extra months at the end of the file (with the time vector corrected) to bypass this problem, but I am limited by the number of months I've decided to add.

knutfrode commented 2 years ago

There is no functionality for cyclic readers, as for Croco itself. However, after creating a reader, it is possible manipulate its validity, e g. by setting reader start_time and reader.end_time as you want. For readers with only a single timestep, it is also possible to set reader.always_valid to True so that it will cover all times. With the former, it should be possible to combine several readers to achieve what you want.