Skip to main content

Questions tagged [rioxarray]

geospatial xarray extension powered by rasterio. https://github.com/corteva/rioxarray

Filter by
Sorted by
Tagged with
1 vote
0 answers
33 views

Using dask.distributed with rioxarray rio.to_raster results in `ValueError: Lock is not yet acquired` [closed]

I am trying to write some code using dask.distributed.Client and rioxarray to_raster that: Concatenates two rasters (dask arrays) Applies a function across all blocks in the concatenated array Writes ...
katieb1's user avatar
  • 31
0 votes
0 answers
20 views

Merging arrays creates gaps betwen, the rasters

I merge many hundred rasters all in the same projection, same orientation, same resolution. The next raster should start where there last ended (no overly, zero gap). I merge DataArrays with rioxarray'...
tetje's user avatar
  • 99
1 vote
1 answer
38 views

rio.to_raster returns ValueError: cannot convert float NaN to integer

Maybe this is more like a Pandas question but when I try to write an xarray to a raster using rio.to_raster() I get a ValueError in Python. If I don't convert the type of xarray to int16 (this is a ...
Andrei Niță's user avatar
1 vote
1 answer
110 views

User-defined reprojection using rioxarray

I'm trying to reproject a raster dataset using a user-defined projection in Python. I was able to achieve the desired reprojection setting ArcGIS's arcpy.CreateCustomGeoTransformation_management tool ...
Liyuneh's user avatar
  • 11
1 vote
0 answers
29 views

Merge Arrays (Mosaic) larger than RAM

I have a bunch of GeoTIFF files. These are about 100 GB on drive, when using compression with zstd (speed level). Hence, when loading, they are still much larger. I can load them in rioxarray with ...
tetje's user avatar
  • 99
1 vote
1 answer
60 views

Reproject large raster using Python

I have some large rasters that I want to reproject in a memory-safe way, using a second raster as a template . This code works nicely for smaller ones, but when they are large the Python kernel ...
TheRealJimShady's user avatar
0 votes
0 answers
8 views

Clipping DataSet leaves pixel outside of desired Polygon

I'm trying to use the clipping from rioxarray to focus on a ROI defined by a bounding box, using the following code : from shapely.geometry import box ds = ... # Clip the Dataset geodf = geopandas....
Bastien Kovac's user avatar
0 votes
0 answers
51 views

rioxarray.open_rasterio() won't close a file when using it with a context manager

I am writing some unit tests to test reading in raster data into an xr.Dataset data structure via the rioxarray.open_rasterio() method. The code creates a test raster to read into rioxarray....
Adriano Matos's user avatar
0 votes
0 answers
87 views

Low performance when writing a large xarray.DataArray with dask

I'm preprocessing HMASR data, the data contains multiple data files with format of netcdf, and each tile (1X1 degree) is a nc file. So I read it through xarray open_mfdataset() to mosaic it spatially ...
孟泽楷's user avatar
1 vote
2 answers
49 views

How to pass GDAL CLI arguments when exporting a GeoTIFF with rioxarray

I have a routine that create a mosaic from COPDEM 30M and I need to export it passing an argument to it. The argument: -mo AREA_OR_POINT=AREA --config GTIFF_POINT_GEO_IGNORE True The behavior I expect ...
Rik Ferreira's user avatar
1 vote
1 answer
60 views

While exporting the rasters using rioxarray, nodata value is undefined after the mask

I have used xarray to open the netcdf file, and using rioxarray exported the raster as a .tif file. However, the exported raster doesn't have definition for nodata value, and hence, the GIS software ...
hillsonghimire's user avatar
0 votes
1 answer
229 views

AttributeError: 'Dataset' object has no attribute 'rio' when using a LocalCluster from dask.distributed

I am trying to parallelize a function that uses a zarr datacube read from an s3 bucket to perform some calculations. However, when using a LocalCluster from dask.distributed, I lose the .rio accessor ...
LaserGlaciers's user avatar
2 votes
2 answers
77 views

Modify cells in a raster, that intersect or are inside a polygon without modify the other cells

I have a raster of a DEM (Digital Elevation Model with values in meters above sea level) in .tiff format, and I need to subtract the value of 10 from the elevation values of cells located within a ...
El Memo de Mileto's user avatar
1 vote
0 answers
101 views

IndexVariable objects must be 1-dimensional Error when reprojecting data

I seem to be having problems with retrojecting data. from xarray import open_dataset import xarray import rioxarray url = "..." crs = "..." dataset = open_dataset(url, ...
Marcel's user avatar
  • 111
0 votes
0 answers
46 views

How can I extract the array indices from a xarray.rio.clip operation?

I have a line of code that clips a Dataset from a larger xarray.core.dataset.Dataset. clipped = ds.rio.clip([user_polygon], crs=4326, all_touched=True) I need to process many of these large datasets (...
John's user avatar
  • 141
0 votes
1 answer
125 views

How does rioxarray reproject match handle nan values?

I have a couple GeoTiffs where the "no data" value is set to 32767. I want to set those values to NaN and then use nearest neighbor interpolation to resample the data and match the ...
MKF's user avatar
  • 571
3 votes
1 answer
297 views

How to write CRS info to NetCDF in a way QGIS can read? (Python/Xarray)

I have a NetCDF file I have subset by geometry and time, and now I need to save it as a new NetCDF file. The original file does not have the CRS set, thus I am setting it in this one. The problem is ...
MKF's user avatar
  • 571
0 votes
1 answer
124 views

How to rasterize point data using average value per cell (not replace or add)

I have a geopandas.GeoDataFrame containing point observations that I would like to rasterize into a grid with a certain resolution, such that, for cells that contain multiple observations, the ...
lusk's user avatar
  • 111
0 votes
0 answers
328 views

Access to the coordinates of a NetCDF file

I started working with NetCDF files recently. I'm working with projected Surge Levels; Data is stored as filename.nc files at Copernicus. This is the file. I got it using an API from their website. ...
terauser's user avatar
1 vote
0 answers
96 views

Landsat from Planetary Computer unexpectedly turns up all no data in some regions

Using some code that gathers Landsat 8 collections from Microsoft Planetary Computer into Open Data Cube xarray using a stac search works fine in some regions but in others returns all nan values. ...
jeremyg19's user avatar
  • 317
0 votes
0 answers
52 views

Reproject by Estimate_utm_crs()

If I am using function x.rio.reproject(x.rio.estimate_utm_crs()) then am I actually considering also parallels? The width and height of pixel changes with different longitude for me, however, The UTM ...
Luckasino's user avatar
  • 293
1 vote
1 answer
643 views

Writing GeoTIFF from dask array using rioxarray in python results in "stripes" of no data

I am trying to write a large raster from a dask array to a GeoTIFF file, but am running into an issue where the resulting raster contains "stripes" of no data. The pixels that do contain ...
katieb1's user avatar
  • 31
1 vote
0 answers
360 views

Loading geospatial datasets with rioxarray

I'm using xarray to open and reproject some .grib files. The files have x, y, and time dimensions and contain several data variables. However, I have some issues with loading the data. Loading them ...
Felix's user avatar
  • 11
0 votes
1 answer
75 views

GeoTIFF from Dataset is very weight and with three bands instead of one

I need to compute the NDVI from an xarray Dataset created using this solution. I've used a for loop to read all the GeoTIFFs in my folder and the result is this: <xarray.Dataset> Dimensions: ...
MaxDragonheart's user avatar
0 votes
1 answer
315 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
1 answer
517 views

Using xarray to write NetCDF4 to GeoTIFF, get AttributeError: 'DataArray' object has no attribute '_data'

I tried to convert GPM nc4 files from NASA into GeoTIFF, but I got an error. Here's my code: import xarray import rioxarray import os os.chdir(dir_path) xds = xarray.open_dataset( "3B-MO.MS....
Wesley Liu's user avatar
1 vote
1 answer
185 views

Using Python (in Colab), how to convert a multiband ee.Image into an ee.ImageCollection?

I ultimately want to convert an ee.Image to an xarray object so I can further process the data. I know the library wxee can do that with ee.ImageCollection.wx.to_xarray(). However, it requires an ee....
Camila's user avatar
  • 21
0 votes
0 answers
346 views

Using rioxarray clip_box function does not return anything

I am trying to clip an xarray dataarray (or dataset, either one) to a bounding box using the rioxarray clip_box() function. My dataarray is 24 hours of temperature data for the continental US. My ...
yeet_man's user avatar
2 votes
2 answers
982 views

Is it possible to change a coordinate in an netCDF loaded with xarray?

I have a netCDF which is loaded in xarray with a dimension named bands (it was originally an import via rioxarray of ENVI data), but actually, I want to be able to parse the data by time. I have tried ...
Ricardo Barros Lourenço's user avatar
0 votes
1 answer
228 views

When i save my xarray DataAarray the coordinates are wrong

I have three 3x3 arrays that are downsampled data from NOAA's Global Hydro Estimator (smaller to make it quicker for testing). One array is lats, one is lons, and one is rainfall. Here's a sample lons:...
JWB's user avatar
  • 604
2 votes
1 answer
223 views

Using coordinates to access GeoTIFF dataset

I'm trying to read a tile from the Sentinel1 SAR data collection. I'm using rioxarray to open the .tiff data file. rioxarray.open_rasterio( path_to_data, overview_level=...
Sina's user avatar
  • 21
2 votes
1 answer
340 views

Converting NetCDF to GeoTIFF

I'm having trouble using rioxarray for converting one time layer of the .nc file to a GeoTIFF. I get the following error: MissingSpatialDimensionError: y dimension not found. 'rio.set_spatial_dims()' ...
Carla S.'s user avatar
0 votes
1 answer
404 views

Rasterizing shapefiles using Geocube

I am trying to create a raster from a shapefile, with cells assigned a value from a specific column within the shapefile. I am using geocube below but am getting an error saying AttributeError: '...
penguin's user avatar
1 vote
0 answers
314 views

How to add additional bands to a TIFF using rioxarray

I'm trying to work out how to open a raster, determine the name of the existing band(s), then use that bands value in math to create a new band. I believe the data is being loaded to a DataArray. I'm ...
anakaine's user avatar
  • 290
0 votes
1 answer
295 views

Save multiple GeoTIFF files from a GRIB file, one file per day (time dimension)

I am trying to save multiple GeoTIFF files from a GRIB file I have elaborated. Before converting to raster, the GRIB file I started with is a ERA5 2m hourly temperature over 3 days: import iris # ...
capocchione's user avatar
1 vote
1 answer
331 views

Masking NetCDF data with a shapefile in that has more than one variable Python

I'm using NetCDF (TROPOSIF data) which i have been able plot and I now want to mask out my AOI with a shapefile. I imported import rioxarray import geopandas as gpd I opened the dataset using ds = ...
Julius Bamah's user avatar
1 vote
1 answer
3k views

Stack rioxarray DataArrays for output to GeoTIFF

I am trying to read a GeoTIFF, perform calculations (radiometric correction) on all bands, and then output back to GeoTIFF. Most of the code I have works fine, up until trying to output. import os ...
GlenS's user avatar
  • 519
1 vote
0 answers
270 views

Georeference NetCDF using rioxarray

I have a NetCDF file with a lot of variables and an improperly set georeference. Loading using xarray works, using rioxarray.open_rasterio I get the following error: "NotGeoreferencedWarning: ...
lisa's user avatar
  • 11
2 votes
0 answers
505 views

Create an xarray dataset form a series of GeoTIFFs and clipping problem

I am trying to create a dataset from a series of GeoTIFFs (one .tiff file per day) and then clip it with a given geometry (shapefile). The TIFF files, one per day, have this format: e.g. day 29-07-...
capocchione's user avatar
1 vote
1 answer
65 views

Estimating area from global raster datasets

I am trying to estimate how much area of emerged landmasses is covered by each of the 12 great groups of soils defined in the USDA Soil Taxonomy with rasterio/rioxarray. My results differ quite a bit ...
e5k's user avatar
  • 160
2 votes
1 answer
234 views

Is there a way to limit the distance of rioxarray's interpolate_na()

I'm trying to run something similar to gdal's fillnodata command line tool in Xarray. Xarray has interpolate_na() that comes with an optional parameter limit where you can limit the number of ...
JWB's user avatar
  • 604
1 vote
1 answer
1k views

Add lat and lon to DataArray read in by rioxarray

I downloaded a GeoTIFF from here: https://www.nass.usda.gov/Research_and_Science/Crop_Progress_Gridded_Layers/index.php (file also available: https://drive.google.com/file/d/1XcfEw-...
Rafael's user avatar
  • 125
1 vote
1 answer
1k views

How to fix CHECK_DISK_FREE_SPACE problem while writing a file with rioxarray?

I get this warning when I try to write out a raster using rioxarray: Free disk space available is 0 bytes, whereas 1152072000 are at least necessary. You can disable this check by defining the ...
hmnoidk's user avatar
  • 709
5 votes
2 answers
445 views

MissingCRS error while opening MODIS data using rioxarray

I have a MODIS data. It is a hdf file (not hdf5). I can open it using ArcGIS and QGIS with no crs. When I use the following script, I get MissingCRS: CRS not found. Please set the CRS with 'rio....
Kadir Şahbaz's user avatar
1 vote
1 answer
386 views

Changes to GDAL NetCDF driver between 3.2 and 3.4

I am preparing data in python using xarray and rioxarray, then exporting to NetCDF. On one machine with micha@RMS:Kinneret$ gdalinfo --version GDAL 3.2.2, released 2021/03/05 the extent of the ...
Micha's user avatar
  • 15.7k
0 votes
1 answer
314 views

How to apply a function on two rasters in Python?

I would like to cell-wise function operation on two rasters. While I saw some examples of adding or subtracting two rasters, I'm yet to come across a complex example of how to manipulate rasters using ...
PPR's user avatar
  • 511
5 votes
3 answers
345 views

Raster Statistics of Fire Driven Forest Loss within shapefile

I have two inputs, a) shapefile, which I am reading in as a geodataframe, download here: https://we.tl/t-QxfgtLWOVN b) raster data from - GFW Fire Driven Forest Loss dataset, download here: https://...
Stuey17's user avatar
  • 199
0 votes
1 answer
67 views

NetCDF stretched along Y (latitude) axis

I'm working with NOAA temperature NetCDF files and trying limit area of interest to the US area only using bounding box. In Jupyter Notebook I wrote few lines to do it and on the plot everything looks ...
nomad_gis's user avatar
2 votes
1 answer
628 views

Clip using geodataframe and rioxarry.clip not clipping xarray dataset

I am trying to clip an xarray dataset using rioxarray.clip with geometry from a geodataframe. I am running the code on a cloud platform built on kubernetes clusters in a distributed manner using Dask. ...
geospatial_laws's user avatar
2 votes
1 answer
370 views

How to use Python packages (GeoPandas, rioxarray) inside GRASS Python scripts?

I want to combine the functionality of GRASS GIS with other Python packages such as GeoPandas and rioxarray. My OS is Windows. It is possible to import other standard packages such as numpy and Pandas....
pittyplaetsch's user avatar