TUDelftGeodesy / stmtools

Xarray extension for Space-Time Matrix
https://tudelftgeodesy.github.io/stmtools/
Apache License 2.0
6 stars 0 forks source link

Querying temporal attributes to an STM #63

Closed rogerkuou closed 4 months ago

rogerkuou commented 7 months ago

Add a enrich_from_stm() function to enrich a STM with spatial temporal data (another STM)

This function should take another xr.Dataset with the same space/time dimension and CRS.

The enrichment should support block-wise operation as enrich_from_polygon .

An example usage adapted from the Documentation example

import xarray as xr

# Read temperature data to query
ds_temperature = xr.read_nc('temperature.nc')

# Read existing stm data
path_stm = Path('./stm.zarr')
stmat = xr.open_zarr(path_stm)

# Enrich
stmat.stm.enrich_from_stm(ds_temperature , space_label=('lat', 'lon'), time_label ='time')

Work example: enrich the STM (Zarr) over Amsterdam in demo with KNMI daily mean temperature.

rogerkuou commented 6 months ago

Might be useful to check: https://github.com/Deltares/xugrid https://xesmf.readthedocs.io/en/latest/

rogerkuou commented 6 months ago

Hi @SarahAlidoost, Freek shared the saptio-temporal data they would like to work with in #64. These data are more relevant than the KNMI dataset. I will copy his message here:

This is the link:

https://www.daggegevens.knmi.nl/klimatologie/uurgegevens

The idea would be to insert meteo data into the STM of the data (e.g. temperature, pressure) closest to the SAR satellite acquisition. (But maybe also: the sum of rainfall in the last 3 days, etc).

Furthermore, I attached:

SarahAlidoost commented 6 months ago

this can be useful https://docs.xarray.dev/en/stable/generated/xarray.Dataset.interp_like.html#xarray-dataset-interp-like example https://docs.xarray.dev/en/stable/generated/xarray.DataArray.interp_like.html#xarray.DataArray.interp_like