Comments (4)
@IAGO1215 without reproducible example nor data nor screenshots it's pretty hard for use to tell what's going on. I can simply make a guess that your data is a COG with internal overview and in QGIS it's the overview that you are seeing
from rasterio.
Dear Sarago,
I have uploaded the raster I am using here. (200MB)
As for the reproducible example:
First, we can open the raster in QGIS, and check the "Information" tab where we can find the max, mean, min... of each band.
Then we can read the first band by rasterio in VSCode. And check the max, mean, min... They should be identical to those shown in QGIS.
a = rio.open('Band') a = a.read(1).reshape(-1) a = a[~np.isnan(a)] a.max()
from rasterio.
With GDAL
GDAL_DISABLE_READDIR_ON_OPEN=FALSE gdalinfo OutputPCA_30_PCs -stats -json | jq '.bands[0]'
{
"band": 1,
"block": [
1137,
1
],
"type": "Float32",
"colorInterpretation": "Undefined",
"description": "PC 1",
"minimum": -71.904,
"maximum": 42.271,
"mean": 0.001,
"stdDev": 12.35,
"metadata": {
"": {
"STATISTICS_MAXIMUM": "42.271053314209",
"STATISTICS_MEAN": "0.0011011385352394",
"STATISTICS_MINIMUM": "-71.90389251709",
"STATISTICS_STDDEV": "12.349624688556",
"STATISTICS_VALID_PERCENT": "8.865"
}
}
}
With Rasterio
with rasterio.Env(GDAL_DISABLE_READDIR_ON_OPEN=False):
with rasterio.open("OutputPCA_30_PCs") as src:
arr = src.read(indexes=1)
non_nan = arr[numpy.isfinite(arr)]
print(non_nan.min(), non_nan.max())
-71.90389 42.271053
In QGIS
from rasterio.
Dear Sarago,
thanks for the prompt reply and the issue has been fixed, and it is not even related to rasterio, which shows the correct max/min values of the raster.
Instead the issue is related to the settings in QGIS on my side. To fix it, I have set "Accuracy" from "Estimate" to "Actual" (as shown in your screenshot), and now it is showing correctly in QGIS as well.
Thanks again for the help.
Best
from rasterio.
Related Issues (20)
- rasterio WarpedVRT vs QGIS Warp tool
- rasterize can no longer handle dtype instances HOT 2
- Change python opener VSI plugin prefix to /vsiriopener HOT 1
- Small typo: Release 1.4a2 requires Python 3.8 instead of 3.9 HOT 1
- Test performance: Dependencies installed twice HOT 1
- `reproject` with `src_geoloc_array` introduces unexpected shift for group of pixels HOT 2
- 1.3.10 release HOT 3
- "pytest.PytestRemovedIn8Warning: Passing None has been deprecated" test failures HOT 1
- Run pyupgrade on code
- Writing a COG to a file-like object in "wb" mode fails in 1.4a2 HOT 4
- Disallow rotated rasters in merge() HOT 3
- Add correct python syntax highlighting to README HOT 2
- update_tags does not work for special tags like PIXEL_OR_AREA HOT 2
- Boundless mask reads are incorrect for complex data and GDAL 3.8
- rasterio.merge.merge() uses ~10 times more memory than specified by `mem_limit` HOT 1
- Unexpected sieve results when mask is entirely false
- Opener registration error for files in same parent directory HOT 9
- access Sentinel-1 IW SLC tiff measurement via S3 on creodias entrypoint
- memory doesn't free using features.geometry_mask function with fastapi HOT 2
- Typo in WarpedVRT's docstring
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rasterio.