Questions tagged [rioxarray]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

Difference between `reproject_match` and `interp_like`

I'm pretty new to GIS and I'm trying to understand the difference between the interpolation done with rioxarray reproject_match and xarray interp_like. Assuming I have two rasters da1 and da2 with ...
1
vote
1answer
25 views

Data masking and plotting issues xarray/rioxarray | geojson -> geoviews

I'm loading a NetCDF file (ERA5 surface temperatures), then I mask the data using country shapes, and finally generate a plot using geoviews. For the unmasked data everything works as intended. As ...
1
vote
1answer
39 views

Masking satellite data using shapefile

I am using Landsat data to determine NDVI for a specific region of interest (roi). However, the roi has buildings and other artificial objects that I wish to mask. I have followed through the example ...
1
vote
0answers
34 views

How to set band names of multi-band GeoTIFF asset upon upload to Google Earth Engine

I have created a multi-bands GeoTIFF using xarray in Python following this answer. When I display this raster or open it in QGIS, all the bands are named following the variable they represent: ...
2
votes
1answer
76 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 ...
2
votes
1answer
37 views

Why are the coordinates in the ODC different from the input data?

Why are the coordinates in the ODC different from the input data? I prepared the following example for clarification and discussion. The used dataset is shown in the following two images: Simple plot ...
0
votes
0answers
48 views

NetCDF4 file to raster with Python

I am trying to read NetCDF4 files from data developed by Toshicika Iizumi (https://doi.pangaea.de/10.1594/PANGAEA.909132) on global crop yields. I would like to turn the data into a form that is ...
1
vote
2answers
62 views

How to find coordinates of pixels of a GeoTIFF image with Python

I have a GeoTIFF image that looks like the following f = rxr.open_rasterio('myFile.tif') f5 = f.sel(band=5) f5.plot.imshow() I would like to create a Pandas dataframe with the values of each pixel ...
1
vote
2answers
54 views

Showing lat long instead of numbered index on spatial data map

I am trying to project meteorological data from a netcdf4 file with its latitude and longitude information and I am not getting how to show lat-long information on the x and y-axis, in the image ...
0
votes
2answers
46 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', ...
1
vote
1answer
57 views

No data found in bounds using rioxarray to clip GeoTiff to shapefile

I get the following error when trying to clip a GeoTiff to a shapefile: "No data found in bounds." Steps to reproduce: import rioxarray as riox rain = riox.open_rasterio( "https://...
1
vote
1answer
37 views

How to delete a raster file after opening the raster in rioxarray

I wanted to able to delete a temporary file, after opening it with rioxarray and start to process the final product. I followed two ideas: a) with rioxarray.open_rasterio(temp_file) as raster: # do ...
0
votes
1answer
57 views

Saving raster to jpeg with rioxarray

I wanted to save a raster (1 band) file as a jpeg with: xarray.rio.to_raster(save_path, compress='JPEG', photometric='YCBCR' if xarray.sizes['band'] == 3 else None, ...
0
votes
0answers
74 views

Conflicting sizes for dimension 'time' with rioxarray

I've been using rioxarray to convert netcdf files to geotiffs, and up till now, it's worked great. However, when I open a ERA5 reanalysis netcdf dataset, rioxarray appears to find that the data size ...
2
votes
2answers
263 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 ...
0
votes
1answer
50 views

Count no data pixel with rioxarray

I want to count the no data values, because when I loaded them with rioxarray they seemed to be oddly many pixel to be non-valid. When I open the given file in qgis the valid pixel percentage is 89.6 %...
3
votes
1answer
406 views

python rioxarray.clip masking netcdf data with a polygon returns all nan

My question is similar to what others have already asked but the posted solutions haven't worked for me. The similar posts are masking a netcdf file using a shapefile of points with rioxarray and how ...
1
vote
2answers
198 views

Masking a NetCDF file using a shapefile of points with rioxarray

I took the proposed solution from this question (How to mask NetCDF time series data from a shapefile in Python?) and tried to implement it. However, whenever I apply this solution it seems to set all ...
0
votes
0answers
28 views

Why does merging from neignboring UTM Zones with rioxarray result into unsharp image?

I am am trying to merge raster files from the Sentinel 2 Constellation (after some processing) with rioxarray for the UTM Zones 32 and 33. It's looking good, execpt when an larger area for example the ...
1
vote
2answers
131 views

Preserve coordinates when converting TIFF image to numpy ndarray

I have satellite image that I want to convert into numy array (and then to Pandas). I already know how to do that thanks to Stefan, but th eproblem is that it does not preserve the coordinate data. ...
0
votes
0answers
40 views

Why do I have such a high memory usage for this rioxarray code?

For my code using rioxarray I am opening quite an amount of raster files. One after another. I even added del to remove those from memory, even though I thought I would not be nessary, because they ...
0
votes
1answer
111 views

rioxarray and vector data (including geocube)

I currently got some problem with rioxarray and geocube. I hope, this is the right place to ask. I am using a vector file for the German state of Brandenburg, so it has a massive hole in it. The file ...
0
votes
1answer
177 views

Issue while performing merge/mosaic of multiple TIFF files using Rioxarray Python

I am trying the following code to mosaic/merge 10 image files (.tif files) using the following code: import rioxarray from rioxarray import merge from rasterio.plot import show items = [r'D:\...
0
votes
1answer
77 views

Extraction affine transformation while using rasterio.features.rasterize

I am currently using rasterio.features.rasterize to rasterize my shapefile. But currently I am always using an Rasterfile to a) rasterize and b) save on disk. The get the information of the ...
3
votes
1answer
206 views

Issue in calculating NDVI using Rasterio Python

I am trying to calculate NDVI using two clipped raster images of Landsat 7 (NIR & Red Bands clipped using mask file) using the following code: import rasterio as rio import numpy as np import ...
1
vote
1answer
222 views

CRS Error when clipping NetCDF using a shapefile

When trying to mask a NetCDF (a daily time series of 31 days) with the code below, I get the following error related to the part of writing the CRS to the rio NetCDF data: CRSError: The WKT could not ...
0
votes
1answer
186 views

Output GeoTIFF file is wrongly rotated to 90 degrees/ -90 degrees using xarray and rioxarray with NotGeoreferencedWarning warning

I am using this file. I wrote this code. import rioxarray import xarray xds = xarray.open_dataset("LIS_HIST_201401010000.d01 copy.nc") floodFraction = xds.FloodedFrac_tavg.transpose('...
2
votes
1answer
555 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....
0
votes
2answers
281 views

Using GDAL, NetCDF4 to GeoTIFF wrongly rotates the output GeoTIFF file 90 degrees

I have written a code that transforms a NetCDF4 data (it can be downloaded from here) to GeoTIFF file using this link. This code works fine. But it seems that it rotates my data 90 or -90 degrees: ...
2
votes
2answers
123 views

Can I open remote datasets with Rasterio?

I know I can open remote datasets with Gdal, I was wondering if I can do the same with Rasterio? Gdal bindings code of what I mean by opening remote dataset: import gdal import numpy import matplotlib....
1
vote
2answers
262 views

How can I merge two bands with different sizes using Rioxarray?

I have two images that I want to combine as follows Expected result: I tried to use the function rioxarray.merge.merge_arrays() in the following way but I got this error that I can't understand: >&...
0
votes
1answer
94 views

How to rectify rioxarray dimensions missing coordinates

I'm currently using the Python module rioxarray to clip an Xarray dataset based on a specific geometry to produce a latitude/longitude grid of coordinates. My data is below: obs_dataset_full xarray....
1
vote
1answer
134 views

How to keep the cell size fixed when clipping a NetCDF/Tiff with a shapefile using rioxarray?

I am trying to clip a Tiff raster with a shapefile. I follow the examples provided in rioxarray (here) The link to raster file (here) and shp file (here) import xarray as xr import rioxarray import ...
2
votes
2answers
654 views

Convert raster to CSV with lat, lon, and value columns

I'm looking for a process to convert ASCII gridded data (in this case 60min/1 degree gridded ASCII population data (GPW) from SEDAC: https://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-count-...
3
votes
3answers
903 views

Extracting data from a raster

I'm currently working on a project where I have to use the map Corine land cover. https://land.copernicus.eu/pan-european/corine-land-cover/clc2018 (You can download the map in the .tif format) I'm ...
1
vote
1answer
120 views

Creating (x,y) coordinates in .nc from .grib2

I have to use a .nc file as input in a model and such model requires projection_x_coordinate and projection_y_coordinate as variables but I don't have them. Is it possible to create them using pyproj, ...
0
votes
1answer
310 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 ...
4
votes
1answer
4k views

Masking NetCDF time series data from shapefile using Python

I have a 3-D time-series precipitation data (187 x 1800 x 3600), stored in a NetCDF file. I need to obtain the precipitation data for a shapefile. import matplotlib.pyplot as plt from netCDF4 import ...
0
votes
1answer
571 views

Cut out selection of NetCDF4 file with shapely geometry

I have a ABI-L1b radiance file in the *.nc file format. I'm trying to cut out a selection of this file with a shapely polygon. I can plot both the netCDF4 file and polygon but I am unsure of how to ...
2
votes
1answer
99 views

Convert LR/LOLA data to latitude and longitude

I have height map data from here LR LOLA DEM from the Moon which seems to be "simple spherical" and I want to convert them to latitude and longitude with this: (It's a bit pseudo code) from affine ...
4
votes
1answer
1k 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 ...
0
votes
2answers
572 views

Extract population count from GeoTIFF based on mask layer

I downloaded Population Count data from Gridded Population of the World (GPW), v4 as a *.GeoTIFF file. In a next step, I would like to extract the population count of a given area based on a mask ...
1
vote
1answer
1k views

Create a new raster TIFF file which is masked based on the GeoJSON file

I was trying to mask the building given its TIFF file and GeoJSON file creating a new raster TIFF file. I don't know what is the problem, the result is all black, here is the code below: from osgeo ...
3
votes
1answer
2k views

How do I add projection to this NetCDF file? (Satellite)

I have been working with satellite data from the GOES-16 satellite for quite some time now. A sample .nc file for this data is located at this NOAA AWS link I use gdalwarp to transform it for ...
1
vote
2answers
436 views

Extract images parts from GeoTIFF file using polygons in a shapefile

I would like to know if there is any way that I can extract images from a GeoTIFF file using an ESRI shapefile which contains shapely polygon data for specific locations in the image in Python. I ...
2
votes
1answer
454 views

What data structure to use for raster data when using rasterio?

I want to write a method in Python that reads a raster (GTiff) using rasterio and returns its contents. Then, some processing is done. Finally, I want to write the data to a new GeoTiff. As far as I ...
3
votes
1answer
555 views

Updating a subset of raster values using open source Python?

I have a source raster data set (tif file) and a number of polygon features. For each one of those polygons I need to: a) 'clip' the raster. b) change values of those clipped raster cells (with the ...
6
votes
1answer
3k 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 ...
7
votes
3answers
10k views

Converting NetCDF dataset array to GeoTiff using rasterio Python

I have read a NetCDF file using the netCDF4 library and then read one of its datasets ("Evapotranspiration") into a variable (variable contains array) using the following code. Subsequently ...
1
vote
3answers
7k views

Masking NetCDF data using shapefile (xarray & geopandas) [duplicate]

I am using the following packages: import pandas as pd import numpy as np import xarray as xr import geopandas as gpd I have the following objects storing data: print(precip_da) Out[]: <...