2,471 questions
0votes
0answers
35views
How can I resolve xarray "unrecognized engine cfgrib"?
An example HRRR file I'm trying to open with xarray: https://storage.googleapis.com/high-resolution-rapid-refresh/hrrr.20250427/conus/hrrr.t18z.wrfprsf06.grib2 When trying to open the dataset with ...
0votes
2answers
55views
Splitting the time dimension of nc data using xarray
Now I have a timelonlat 3D data where time is recorded as year, month and day. I need to split time in the form of year*month+day. So that the data becomes 4 dimensional. How should I do this? I have ...
0votes
0answers
38views
One variable in xr.DataArray has an index depending on another variable, how to correctly implement this?
I am trying to get started using Xarray, but having an issue with a specific task: the labels I want to use in one dimension are dependent on another dimension. Specifically, in the example below, the ...
1vote
1answer
100views
How to select from xarray.Dataset without hardcoding the name of the dimension?
When selecting data from an xarray.Dataset type, the examples they provide all include hardcoding the name of the dimension like so: ds = ds.sel(state_name='California') TLDR; How can you select from ...
0votes
0answers
22views
What is the data_vars argument of xarray.open_mfdataset doing?
I have two datasets with identical dimension names and shapes and I am trying to use xarray.open_mfdataset() to merge them into one dataset before opening them. You can drop this code in your own IDE ...
0votes
0answers
41views
rioxarray and clip for a netcdf
I'm looking to use a shapefile to rio.clip a raster so I can find where they overlap. I'm using the polygon for the overlap (in operation it will be a state or county shapefile, this is simplified for ...
0votes
1answer
69views
What is the difference between an xarray Dataset and a DataArray?
According to the xarray documentation: xarray.DataArray is xarray’s implementation of a labeled, multi-dimensional array. To me, this means a DataArray is just numpy with labels. However, xarray ...
0votes
1answer
60views
Getting [Errno 22] Invalid argument when trying to access data variables
I have a grib file containing reanalysis (an), ensemble mean (em), and ensemble spread (es) data. The dataset I access is the analysis data, import xarray as xr import cfgrib file = 'C:/Users/...
1vote
0answers
37views
Calculating a step in a direction of a vector
I have gridded atmospheric field data stored in an xarray.DataArray. I computed its gradient and rotated it to obtain vector components that are tangent to the isolines at each grid point: ddata_dlon =...
0votes
1answer
35views
How can I initialize a Zarr file that is larger than available memory?
My workflow generates a dataset of format xr.Dataset with dims (6, 36, 2, 13, 699, 1920) in float32. I can process and write output array chunk by chunk, but only if the zarr file already exists, with:...
0votes
0answers
51views
Applying a custom function to Xarray resample drops the dimension coordinates
When using the map method to apply a custom function in Xarray resample, the dimension coordinates are lost, and the resulting Dataset has a sequence instead of the actual coordinate values. The ...
0votes
1answer
111views
How to use numpy masked arrays to create a masked xarray DataArray?
I'm using metpy.calc.windchill in order to calculate wind chill values, and it automatically spits out an array with a numpy mask on it. t2m, uwind, and vwind all come from ERA5 (on the Google Cloud: ...
0votes
2answers
85views
A Netcdf file were generate from Google Earth Engine with the aid of packages Xee: Xarray + GEE and I can't open correctly it in QGIS
I am trying to generated Netcdf files from a imageCollection. The code is working fine. I can save as nc file and reopened it in Colab using Xarray package. I also can open it in Panoply, however it ...
1vote
1answer
65views
How to remove xarray plot bad value edge colour
I know set_bad can colour the pixel into a specific colour but in my example I only want to have edge colour for blue and grey pixels with values and not the bad pixels (red) import matplotlib.pyplot ...
0votes
1answer
47views
Open a xarray created netCDF in QGIS
I have created a netCDF file using xarray in python with the code below: latitude_save = sorted(list(set(copy2_sorted['lat']))) longitud_save = sorted(list(set(copy2_sorted['lon']))) time_save = ...