Working with non-standard dimensions in the "water level change indicators" dataset

Hi

For one of our training events I am exploring the dataset "Water level change indicators for the European coast from 1977 to 2100 derived from climate projections." As per the description, this dataset has a variable grid resolution.


When retrieving the data into the Toolbox, I get an array that looks like this:

<xarray.DataArray 'tide_height' (time: 29, station_id: 23256)>
dask.array<xarray-tide_height, shape=(29, 23256), dtype=float64, chunksize=(29, 23256), chunktype=numpy.ndarray>
Coordinates:
  * station_id  (station_id) |S40 b'id_coast_glob_eur_00001' ... b'islands_88...
    lon         (station_id) float64 dask.array<chunksize=(23256,), meta=np.ndarray>
    lat         (station_id) float64 dask.array<chunksize=(23256,), meta=np.ndarray>
  * time        (time) datetime64[ns] 1977-01-01 1978-01-01 ... 2005-01-01
Attributes:
    long_name:              Annual_maximum_tidal_level_including_annual_mean_...
    units:                  m
    short_name:             annual_tidal_maxima
    standard_name:          sea_surface_height_amplitude_due_to_tide
    cds_magics_style_name:  blue_white_red_-1_1
    type:                   real
    valid_min:              0.0


So the dimensions of my data are (time, station_id) not (time,lat,lon) as in most datasets. Latitudes and longitudes are there, but not as dimension coordinates.

Unfortunately this means that some of the standard Toolbox functions (for example, to extract data for a location of interest) no longer work. For example:

    data_sel=ct.cube.select(data,lat=53.3498,lon=-6.2603)
    # or 
    data_sel = ct.geo.extract_point(data,lon=-6.2603,lat=53.3498)


Gives me an error: 

ValueError: dimensions or multi-index levels ['lat', 'lon'] do not exist


I would have thought that, if this dataset is being offered through the CDS, the Toolbox should give me some functions to work with this type of data? But maybe I am overlooking something? 

I've managed to get around this problem by extracting the latitude and longitude coordinates and making a subset based on a range of values, but it seems a bit clunky to me: https://cds.climate.copernicus.eu/toolbox-editor/13784/uls_water_level_dataset


And how would you go about plotting this dataset as a map? I'm probably overlooking some other obvious solutions, perhaps someone can give me some pointers?


Many thanks

Rutger




Dear Rutger,

Here is a suggestion of how you could plot your data: https://cds.climate.copernicus.eu/toolbox-editor/168/plot_observations

I have also included a line to do a geographical selection of you observations using ct.cube.box_select:

data_sel = ct.cube.box_select(data, lon=[-7, -6], lat=[53.3, 53.4])

Unfortunately I could not find a tool that allows to select the nearest station to a given lat and lon coordinate if this coordinate is not a dimension.

I hope this helps.

Regards.

Vivien