Deltares / Deltares/imod-python

rasterio.open; attrs remain empty

Open
#156 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug has attachment
Dominant language
Python
Stars
41
Forks
12
Avg merge
21h 8m
Merged PRs (30d)
1

Description

In GitLab by @tomvansteijn on Feb 11, 2021, 09:45

When opening an integer raster file (gtiff), the crs and nodata value are properly set in the DataArray attrs dict. However, when opening another raster file, a float raster, the attrs remain empty.

Not sure if the dtype makes the difference. When the attrs are not set, the "dmin" and "dmax" properties are not calculated correctly as the raster nodata value is not taken into account. This shows in the colormap in the iMOD viewer.

Attached a raster file for which the attrs remain empty when calling rasterio.open.

recharge_mmd.zip

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the attached recharge_mmd.zip file and compare rasterio.open behavior for the integer and float rasters. Inspect where the opened DataArray attrs are populated, then verify that crs and nodata are retained and that dmin and dmax account for nodata values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.