Skip to main content

Questions tagged [xarray]

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

11 votes
3 answers
23k views

How to clip an xarray to a smaller extent given the lat/lon coordinates?

I have a netcdf file showing elevation over Europe derived from GTopo30. Turns out that the extent of this raster file is too big to combine it with other layers, so I would like to crop it to a given ...
Irene's user avatar
  • 1,240
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
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
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
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
6 votes
1 answer
11k views

Indexing coordinates in order to get a value by coordinates from xarray

Firstly, I am a super rookie and just recently started working with GIS. Therefore I am not sure how to ask/word the question, or even if it makes sense. So bear with me. I have some NetCDF files, ...
Burak Özmen's user avatar
6 votes
2 answers
3k views

Opening EOS netCDF4/HDF5 file with correct format using xarray?

I am using xarray (version 0.12.2) to work with the MODIS/Terra+Aqua MAIAC Land Aerosol Optical Depth dataset (MCD19A2.006). xarray successfully opens that dataset with the correct variables and ...
Kel Markert's user avatar
  • 1,128
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
5 votes
1 answer
6k views

Adding compression to a NetCDF file using xarray

I have a raster that I am trying to compress and convert to a NetCDF format with compression level = 9 using the xarray package. I assume that the compression is added using the encoding parameter as ...
gwydion93's user avatar
  • 1,913
5 votes
1 answer
2k views

GDAL crashes with segmentation fault when trying to open a NetCDF subdataset with time dimension

I am trying to create a NetCDF file which is compliant with the NetCDF Conventions CF-1.4. The dimensions of the file are (TIME, Y, X) where Y and X are the polar stereographic grid. The file that I ...
ajt's user avatar
  • 91
4 votes
1 answer
4k views

How to save an xarray.DataArray directly as a Cloud Optimized GeoTIFF?

Is there a good way to produce a cloud-optimized GeoTIFF (https://www.cogeo.org) directly from an xarray.DataArray? At the moment it takes me a couple of steps to produce an intermediate regular ...
weiji14's user avatar
  • 1,751
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
4 votes
1 answer
415 views

Converting NOAA's World Ocean Database NetCDF files to tabular data using Python

I'm trying to convert variables from NetCDF files to tabular data, but can't understand how to group observations by some index or key variable. For example, when loading data from WOD queries using ...
thiago's user avatar
  • 51
4 votes
0 answers
79 views

Looking up whole time-series for specific point from 45 GB file

I want to look-up 8760 times for a single lat/lon combo in less than a second from 43.82 GB file of wind data containing: 8760 times (every hour in a year) 721 latitudes (every 0.25° from -90.0° to ...
user212905'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

15 30 50 per page
1
2 3 4 5
9