Xarray - N-D labeled arrays and datasets in Python
2,353
questions
0
votes
0
answers
6
views
Python: How to optimize loading zarr files/groups from gcs using xarray?
I have a database of zarr groups on gcs, and everytime I try to load them using xarray it takes over 5 seconds regardless of the size.
I tried saving the files with different chunking parameters and ...
0
votes
0
answers
27
views
xarray plot sparse data
Xarray uses pcolormesh for plotting. For example 2D data, but where 1 axes is not continuous pcolormesh will interpolate values. The nice thing from xarray is that it is "coordinate aware", ...
0
votes
0
answers
19
views
xarray geoviews vectorfield
I'm having trouble implementing this for a vector field with a time dimension. My data is stored in an xarray dataset. Currently I am only implementing this for one time step of the data, whereas the ...
1
vote
2
answers
64
views
+50
How to merge two xarray.Datasets based on common coordinates
I want to merge two xarray.Dataset-objects.
My code looks as follows:
import numpy as np
import xarray as xr
N_CHAINS = 4
N_DRAWS = 1000
N_PLAYERS = 5
player_idx = [1, 1, 2, 3, 4, 4, 0, 0, 2, 2]
...
0
votes
0
answers
26
views
Reshaping xarray from NetCDF dimensions
I have a NetCDF file that indexes data using Along/Across dimensions, and I want to index by latitude/longitude instead.
This is an example DataSet:
#create Dataset
U=[[1,2],[3,4]]
V=[[3,4],[1,2]]
...
0
votes
0
answers
19
views
Is there an easy way to reorder the coordinate levels in a DataArray?
I have the following DataArray.
data = xr.DataArray(
np.arange(24).reshape(2, 3, 4),
dims=['x', 'y', 'z'],
coords={
'x': ['a', 'b'],
'y': [10, 20, 30],
'z': [100, ...
0
votes
0
answers
22
views
Saving a raster file without including no-data values in Python
I have a file in TIF-format that I am trying to save with rioxarray in Python, but when I save it normally, the file size and height/width is much larger than they should be. If I look at the file ...
1
vote
1
answer
36
views
How can I choose to not change the image size when reprojecting with Python rioxarray?
I have an image in tif-format of size 18346x10218 in coordinate system EPSG:4326 that I want to convert to a new coordinate system, which I do with the following method with rioxarray in Python.
...
0
votes
0
answers
26
views
Can rechunking using dask may help to load data faster?
I have a single data file as file.h5.gz having 4GB size. I used
fZe1 = gzip.open(eDataFN1, 'rb')
fDataIne1 = h5py.File(fZe1, 'r')
to load the file. It takes much longer time to load. The file ...
0
votes
1
answer
42
views
Performing sklearn.linearmodel ridge regression on xarray data which contains nan elements
I'm attempting to perform a multiple linear regression with ridge corrections to determine the relationship between certain spatial variables in an xarray Dataframe. Because these are observed data, ...
0
votes
1
answer
19
views
Correlating a resampled data array with a constant array in python
I am trying to use a bootstrap resampling technique to test the significance of the correlation between rainfall data and an index. I would like the rainfall data to be resampled/shuffled 1000 times, ...
-1
votes
0
answers
19
views
No data in Bounds When clip the netcdf by using rioxarray
This issue related to this post. But there is difference. I set all_touched=True,the code still report same error.
As you can see the detail for the boundary. It's very small and touched the grid. I ...
0
votes
0
answers
27
views
Grouping based on other variables
I have an Xarray dataset with x and y coordinates and 3 variables agb, col and row. You can have an overview looking at this (don't care about other coords/vars)
My goal is to group agb values based ...
0
votes
0
answers
24
views
ZARR: Inefficiency in Selecting Data Based on Bounding Box Coordinates with TIME Dimensions Only dataset
I have the following dataset which is a trajectory type dataset.
LATITUDE and LONGITUDE are defined as coordinates in xarray BUT they aren't dimensions! All of the issues I've came across on ...
0
votes
1
answer
19
views
Multiply xarray map by country specific values
I have one xarray dataset (da_main) with lat, lon dimensions and I want to multiply this dataset by another dataset that depend on the country (da_value_per_country).
I also have a dataset giving me ...