umr-lops / xsar

Synthetic Aperture Radar (SAR) Level-1 GRD python mapper for efficient xarray/dask based processing
https://cyclobs.ifremer.fr/static/sarwing_datarmor/xsar/
MIT License
25 stars 8 forks source link

add variables to dataset from raster files (ecmwf) #32

Closed oarcher closed 2 years ago

oarcher commented 2 years ago

close #30

oarcher commented 2 years ago

with this commit:

import xsar
from xsar.raster_readers import ecmwf_01_1h_reader
import xarray as xr
import rioxarray 
import holoviews as hv
import datetime
import numpy as np
hv.extension('bokeh')

filename = '/home/oarcher/SAFE/S1A_IW_GRDH_1SDV_20210909T130650_20210909T130715_039605_04AE83_C34F.SAFE'
s1meta = xsar.Sentinel1Meta(filename)
s1meta.set_raster('ecmwf', '/home/oarcher/tmp/ECMWF_FORECAST_0100_202109091300_10U_10V.nc', read_function=ecmwf_01_1h_reader)
sar_ds = xsar.open_dataset(s1meta, resolution='1000m')

hv.Image(sar_ds.ecmwf_WSPD).opts(cmap='jet') + hv.Image(sar_ds.sigma0.isel(pol=0)).opts(cmap='gray')

@vincelhx , can you check that it's works as expected for you ?

You will need to use my repo:

git clone https://github.com/oarcher/xsar
cd xsar
pip install -e .