From 7848212ff458c64953eafc9a6e5cdf0427e33a6e Mon Sep 17 00:00:00 2001 From: veenstrajelmer <60435591+veenstrajelmer@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:35:45 +0200 Subject: [PATCH] 998 remove escape for not monotonic cmems insitu datasets (#999) * removed code for non-monotonic cmems observation files * drop removal of MO_TS_TG_ANDRATX that had varying lat/lon coordinates, not present anymore --- dfm_tools/observations.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/dfm_tools/observations.py b/dfm_tools/observations.py index aa212dc7d..234cea603 100644 --- a/dfm_tools/observations.py +++ b/dfm_tools/observations.py @@ -252,12 +252,7 @@ def cmems_ssh_read_catalog(source, overwrite=True): bool_tidegauge = index_history_pd["file_name"].str.contains("/history/TG/") bool_slev = index_history_pd["parameters"].str.contains("SLEV") index_history_pd = index_history_pd.loc[bool_tidegauge & bool_slev] - - # drop andratx station, lat/lon vary over time in nrt dataset - # TODO: remove this exception when the CMEMS nrt dataset is cleaned up - bool_moving = index_history_pd["file_name"].str.contains("MO_TS_TG_ANDRATX") - index_history_pd = index_history_pd.loc[~bool_moving] - + # generate geom and geodataframe assert (index_history_pd["geospatial_lon_min"] == index_history_pd["geospatial_lon_max"]).all() assert (index_history_pd["geospatial_lat_min"] == index_history_pd["geospatial_lat_max"]).all() @@ -598,17 +593,6 @@ def cmems_ssh_retrieve_data(row, dir_output, time_min=None, time_max=None, # drop all unnecessary vars ds = ds.drop_vars(["SLEV_QC","TIME_QC","DEPH_QC","LATITUDE","LONGITUDE","STATION","POSITION"], errors="ignore") - # check order of time variable - if not ds.time.to_pandas().index.is_monotonic_increasing: - # TODO: happens in some MO_TS_TG_RMN-* stations in NRT dataset, asked to fix - # Genova, Imperia, LaSpezia, Livorno, Ravenna, Venice - stat_name = row.loc["station_name_unique"] - print(f"[{stat_name} NOT MONOTONIC] ", end="") - del ds - os.remove(file_data_raw) - return - # ds = ds.sortby("time") - # slice on time extent ds = ds.sel(time=slice(time_min, time_max)) if len(ds.time) == 0: