Skip to content
Advertisement

Tag: python-xarray

Efficient way to extract data from NETCDF files

I have a number of coordinates (roughly 20000) for which I need to extract data from a number of NetCDF files each comes roughly with 30000 timesteps (future climate scenarios). Using the solution here is not efficient and the reason is the time spent at each i,j to convert “dsloc” to “dataframe” (look at the code below). ** an example

rioaxrray open netcdf file result is a list not an xarray

I am trying to open a netcdf file using rioarray: import rioxarray import xarray import raster xds = rioxarray.open_rasterio(file, crs=’+proj=latlong’, masked=True) but: type(xds) list and xds has none of the attributes or methods of an xarray. xds_lonlat = xds.rio.reproject(“epsg:4326”) AttributeError Traceback (most recent call last) in —-> 1 xds_lonlat = xds.rio.reproject(“epsg:4326”) AttributeError: ‘list’ object has no attribute ‘rio’ clipped =

How to make a sum in NetCDF4 by xarray

I would like to make a monthly sums of my NetCDF4 file from daily values for precipitation. However, I am quite not sure what I am doing wrong. It seems that something has changed from the code in this post: Sum a daily time series into a monthly time series with a NaN value threshold I didn’t find anything helpful

Advertisement