Questions tagged [rioxarray]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
28 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
  • 307
0 votes
0 answers
19 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 ...
Lukáš Tůma's user avatar
1 vote
1 answer
161 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
  • 13
1 vote
0 answers
84 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
39 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
87 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
123 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
72 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
82 views

Reprojecting NetCDF file from LCC to WGS84: 'Multiple grid mappings exist' error

I try to reproject a NetCDF file to WGS84 so I can clip it with a regional geometry for analysis. The file is a dataset with the CORDEX precipitation variable, climate change scenario rcp 2.6, years ...
Dio Nik's user avatar
0 votes
0 answers
52 views

Cordex precipatation values reproject to WGS84 from Lampert Conical

I have to calculate some precipitation indices for a region, and for this I have to reproject the dataset to WGS84. I have the following code to obtain the datasets: import cdsapi import rioxarray as ...
Dio Nik's user avatar
0 votes
0 answers
182 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
376 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
140 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
  • 524
1 vote
1 answer
156 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
  • 11
0 votes
0 answers
225 views

Clipping an xarray dataset with rio clip function produces empty xarray

I have an xarray dataset ds containing a variable 'pop'. xarray.Dataset Dimensions: time: 1latitude: 5751longitude: 13197 Coordinates: time (time) datetime64[ns] 2000-12-31 latitude (latitude) float64 ...
Code_Pi's user avatar
2 votes
1 answer
206 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
149 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
0 votes
0 answers
70 views

Using rioxarray to open netcdf output from polymer

I'm using rioxarray to clip some .nc files processed through Polymer (atmospheric processor). The issue I'm having is when I import the .nc file I get the following error: The original file was in ...
Steven Rego's user avatar
1 vote
0 answers
189 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
  • 270
0 votes
1 answer
169 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
245 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
0 votes
0 answers
208 views

Using xarray and rioxarray for converting netCDF to GeoTIFF gives TypeError: cannot pickle '_thread.lock' object

I am trying to convert a netCDF file to GeoTIFF file using xarrray and rioxarray. But when I give the rio.to_raster command, it throws the TypeError: cannot pickle '_thread.lock' object. The NetCDF ...
Pradeep S's user avatar
1 vote
1 answer
1k 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
  • 459
1 vote
0 answers
134 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
369 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
37 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
  • 150
1 vote
1 answer
137 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
  • 524
0 votes
1 answer
596 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
  • 115
1 vote
1 answer
585 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
  • 679
5 votes
1 answer
311 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
218 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.4k
0 votes
1 answer
225 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
  • 481
5 votes
3 answers
302 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
56 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
372 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
293 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
1 vote
1 answer
1k views

How to deal with Nan value when using rioxarray rio.reproject()?

I was trying to use rio.reproject_match() to match the resolution of two xarray datasets. However, when I used resample methods like Resampling.bilinear or Resampling.average, a large area would ...
QRW's user avatar
  • 33
0 votes
0 answers
533 views

Combine two raster datasets from different areas - xarray

I simply wish to combine two raster datasets from different spatial extents and with different coordinate reference systems using python. Eventually, I wish to combine enumerable datasets, but ...
Sean Carter's user avatar
1 vote
1 answer
1k views

Xarray Dataset to raster - ValueError: failed to prevent overwriting existing key grid_mapping in attrs

I have a netcdf file located here http://thredds.northwestknowledge.net:8080/thredds/catalog/TERRACLIMATE_ALL/data/catalog.html?dataset=TERRACLIMATE_ALL_SCAN/data/TerraClimate_tmin_1958.nc. I am ...
Stefano Potter's user avatar
4 votes
2 answers
2k views

Vectorizing a raster containing holes using rasterio

I want to vectorize raster that contains holes (nodata) in the areas with valid data. My current version uses rasterio.features.shapes: shape_list = list(shapes(raster.values, mask=raster.values !=...
Sebastian H's user avatar
1 vote
1 answer
139 views

RuntimeWarning when I try to plot a raster

I'm using JupyterNotebook to analyze some GIS data. I need to clip a raster and plot the result but I've a strange problem. Folder with data is here; the raster size is 1MB. I'm be able to plot the ...
MaxDragonheart's user avatar
1 vote
1 answer
354 views

How to convert crs_wkt starting with GEOGCRS to a ogc_wkt string (to use rioxarray.reproject_match)

I have two xarray data arrays (1. land_data, 2. climate_data) that I want to reproject and match (rio.reproject_match()): climate_data_matched = climate_data.rio.reproject_match(land_data) Land data ...
ProgMau's user avatar
  • 33
0 votes
1 answer
890 views

Why do rioxarray reprojection and pyproj transform give different values when selecting a pixel by point coordinates?

I'm opening this grib file using rioxarray and reprojecting to WGS84 in the following manner with the goal of grabbing pixel values by coordinates. import rioxarray url = 'https://noaa-hrrr-bdp-pds....
JWB's user avatar
  • 524
1 vote
1 answer
581 views

Extract by polygon from a rioxarray's raster

I'm attempting to extract NBR mean value from MODIS data based on a set of polygons. The polygon set has overlapping everywhere (don't blame me, it's not my work nor my idea). The shapefile is ...
aldo_tapia's user avatar
  • 13.1k
1 vote
2 answers
529 views

Add projection to rioxarray dataset in Python

I've downloaded a netcdf from the Climate Data Store and would like to write a CRS to it, so I can clip it for a shapefile. However, I get an error when assigning a CRS. Below my script and what is ...
CrossLord's user avatar
  • 215
0 votes
2 answers
680 views

How to stack list of Xarrays

I have a folder with 4 .tiff (GeoTiff) files. Each of these contains two layers (the spectral band and a mask). I'm able to create a list containig each image using xarray.open_rasterio. Now I need to ...
sermomon's user avatar
  • 1,084
0 votes
1 answer
1k views

Converting raster GeoTIFF or NetCDF to image in Google Earth Engine

I try to convert raster tif or netcdf file to ee.Image Google Earth Engine object in Python. The netcdf raster testing data (5-bands) is in this link. Here I converted the first band from raster file ...
Tuyen's user avatar
  • 209
1 vote
0 answers
29 views

Polygon clipping with percentage tile membership

Let me setup the problem: I have a tiled world map (0.1° x 0.1°) with values assigned to each tile. I want to assign the values to each country, and I'm doing so by clipping to their ZEE mask. But ...
marcopolobronch's user avatar
0 votes
0 answers
351 views

Xarray to NetCDF with transform applied

I have a process that uses rioxarray to crop GeoTIFFs and create a nice xarray dataset. This works well. When I export to new GeoTIFFs they are perfect, coordinates and data are fine. When I try to ...
Jamie Dunbar's user avatar
0 votes
1 answer
194 views

Wrong results using xarray groupby to calculte anomalies

I want to compute ten days anomalies based on MODIS NDSI. The data is stored as a GeoTIFF. For this task I have two folders, one with the reference period of 2001-2020 and one with 2001-2022 for which ...
George Boldeanu's user avatar