pySTEPS / pysteps

Python framework for short-term ensemble prediction systems.
https://pysteps.github.io/
BSD 3-Clause "New" or "Revised" License
456 stars 166 forks source link

Allow for reprojection and up/downscaling of DataArrays #230

Closed RubenImhoff closed 2 years ago

RubenImhoff commented 3 years ago

With our move to pysteps v2 and our plan to implement blending with NWP, we will run into problems with different grids and spatial projections of the models. An example of this is the KNMI NWP model data, which have a lat-lon grid and a coarser resolution than the radar data. Hence, this asks for a reprojection and downscaling of the NWP rainfall fields.

Does anyone know about good Python-tools for reprojection and down/upscaling? I'd be happy to try to implement this next week or so.

aperezhortal commented 3 years ago

Hi @RubenImhoff, I used in the past rasterio to do that. It is very fast. https://rasterio.readthedocs.io/en/latest/topics/reproject.html

RubenImhoff commented 3 years ago

Thanks @aperezhortal! Rasterio is indeed a nice package to work with, good option.

dnerini commented 3 years ago

rasterio is very nice library, but to avoid an additional dependency, it should also be possible to relatively easily obtain what you need with a combination of pyproj and xarray's resampling method.

aperezhortal commented 3 years ago

[Edited] Actually, it seems that xarray has a reprojection functionality: https://corteva.github.io/rioxarray/stable/examples/reproject.html But it seems that uses rasterio under the hood.

kmuehlbauer commented 3 years ago

A colleague recommended pyresample https://pyresample.readthedocs.io/en/latest/index.html

Pyresample only has numpy, scipy and xarray as more or less hard dependencies. I did not explore it in depth since wradlib uses gdal for reprojection/resampling under the hood.

RubenImhoff commented 3 years ago

Thanks for your suggestions so far, this can give a good start!

cvelascof commented 3 years ago

Hi all ... I personally use XESMF https://pangeo-xesmf.readthedocs.io/en/latest/. XESMF integrates very well with xarray and dask but I agree that we should try to keep pySTEPS dependencies limited.