COSIMA / cosima-cookbook

Framework for indexing and querying ocean-sea ice model output.
https://cosima-recipes.readthedocs.io/en/latest/
Apache License 2.0
58 stars 25 forks source link

Add get_ranges query function #338

Open angus-g opened 7 months ago

angus-g commented 7 months ago

This function returns a DataFrame containing the distinct ranges of contiguous data. For example,

>>> cc.querying.get_ranges(session, "01deg_jra55v13_ryf9091", "u", "1 daily")
                 start                  end
0  1950-01-01 00:00:00  1950-02-01 00:00:00
1  1950-02-01 00:00:00  1971-01-01 00:00:00
2  2086-01-01 00:00:00  2100-10-01 00:00:00
3  2100-10-01 00:00:00  2101-01-01 00:00:00
4  2170-01-01 00:00:00  2180-01-01 00:00:00

Curiously, this example does highlight an inconsistency in the data for this experiment, but it does show the gaps where no daily velocity data is available.

Probably not quite ready (and definitely needs some tests!), but I thought I'd get this out there while it's fresh on my mind.