hydro-python / hydropowerlib

GNU General Public License v3.0
11 stars 4 forks source link

Integrate netcdf data files from Geesthacht #2

Open coroa opened 5 years ago

birgits commented 5 years ago

@birgits Notebook in examples + @coroa adds how to calculate feed-in for powerplants @coroa asks at HZG if upstream areas could be provided and if algorithm to find most suitable grid cell is as he thinks.

coroa commented 5 years ago

To correct the date format and the coordinates in the netcdf files, you can use something like:

ds = xr.open_dataset("7062009_meanflow_2014.nc")
ds["time"] = pd.to_datetime(ds.indexes['time'].astype(str), format="%Y%m%d")
ds = ds.assign(lon=ds.coords['lon'].isel(nlat=0), lat=ds.coords['lat'].isel(nlon=0))
ds = ds.swap_dims({'nlon': 'lon', 'nlat': 'lat'})