Skip to main content

Questions tagged [xarray]

xarray is a Python module for working with N-dimensional arrays

0 votes
1 answer
1k views

Clip global data by polygon using rioxarray fails (off by 180 longitude)

I want to extract CMIP6 climate data within polygons defined by a selection of the Large Marine Ecosystems of the world. The data(CMIP6) are found in ranges from 0 to 360 degrees longitude, while my ...
Trond Kristiansen's user avatar
7 votes
1 answer
6k views

xarray slicing across the antimeridian

I'm just starting with using xarray for working with n-dimensional NetCDF datasets. I particularly like the techniques for slicing using both indexes and labels (isel and sel): import xarray as xr ds ...
alphabetasoup's user avatar
6 votes
1 answer
3k views

Using Rioxarray / QGIS Projection

For the past couple weeks I have been trying to view GOES17 data from netCDF files (converted to geotif) in QGIS 3.10 but cannot get the projection to work correctly. I have attempted numerous ...
ba0a2794's user avatar
3 votes
1 answer
3k views

Converting a NetCDF from 0 to 360 to -180 to 180 via xarray

I've got an ERA5 NetCDF that's in 0 to 360 and I'd like to convert it to -180 to 180 before saving it off as a raster. I've got the current workflow set up, but am unsure of how to switch the longs. ...
JWB's user avatar
  • 604
9 votes
3 answers
17k views

Mask xarray dataset using a shapefile [closed]

I have used xarray on some satellite data that I'd like to mask it using a shapefile. I have previously been doing this using a combination of PIL, numpy and gdal, but it would be cleaner to do this ...
JackLidge's user avatar
  • 338
7 votes
1 answer
12k views

Extracting data within geometry (shape)

I have a NetCDF dataset which I normally call using the xarray function. I have recently been doing some transect analysis on the dataset, which looks something like this (the area between the ...
Ep1c1aN's user avatar
  • 179
6 votes
1 answer
11k views

Using rioxarray to assign spatial reference (EPSG:4326) to NetCDF built from CSV with lat long columns

I am trying to create a NetCDF from a CSV file. The idea comes from the fact that the original CSV comes with many columns, three of these representing: a specific year ("time") the Y ...
umbe1987's user avatar
  • 3,785
4 votes
1 answer
3k views

How to save a clipped NetCDF data as a new NetCDF file in Python?

I have used xarray to clip my NetCDF file‌ (it can be downloaded here) by a shapefile (it can be downloaded from here). Here is the code: import xarray import rioxarray import geopandas from shapely....
Muser's user avatar
  • 225
2 votes
1 answer
1k views

Georeferencing Sentinel-3 LST product

I have been stuck attempting to convert Sentinel-3 LST netCDF data to geotiffs for a while now as part of my master's thesis. Firstly, an introduction to the data. It is packaged as follow: The data ...
TheOGMalan's user avatar
2 votes
2 answers
4k views

Open and plot a large raster with Python xarray

I have an ASCII Esri file of the type: ncols 5201 nrows 4001 xllcorner -65 yllcorner -35 cellsize 0.025 NODATA_value -9999 -9999 -9999 -9999 255 256 -9999 -9999 ... -9999 -9999 -9999 -9999 -9999 -9999 ...
gioarma's user avatar
  • 133
0 votes
1 answer
358 views

Memory filled with Xarray concat function

I'm facing in trouble related to the limit of my RAM. On my PC I have 32GB of RAM that is totaly filled from the concat of some DataArray. I've create e simple function below to read a single band of ...
MaxDragonheart's user avatar
0 votes
0 answers
101 views

Performance difference between xarray open_mfdataset and open_dataset

I'm dealing with CMIP6 Scenariomip data, I have eight ESMs precipitation grid that each one is composed by multiple netcdf files. There is one ESMs's netcdf files are seperately reserved every decade, ...
孟泽楷's user avatar
0 votes
2 answers
1k views

How to mask and scale raster using rasterio?

I have been trying to read a raster file in netcdf format which I will later on sample. I need to read using the DatasetReader as float. When I read: ds = rasterio.open(f'netcdf:{file}:AOT_L2_Mean', ...
Nikko's user avatar
  • 611