Comments (3)
Thanks for the good report @lhcorralo. It looks like the underlying issue is rasterio/rasterio#2916.
Short explanation: the xarray is basically composed of multiple tiles, spatially. It's also reading from multiple items, which cover different areas. When a tile doesn't overlap with an item at all, stackstac has an optimization to return all NaNs for the tile. But when the tile overlaps with an item, we use rasterio to read it. It looks like in this particular dataset, the GeoTIFFs don't have a nodata
value set, so GDAL is filling in 0s for the pixels outside the bounds of the item, but not actually telling us that they should be masked out. However, the mosaic
operation is only treating NaNs as nodata, so the 0s are left in, resulting in the stripes. That's also why max
works: any actual data value is greater than 0.
I'll push up a fix for this, but for now, you can probably work around this with:
stack = stackstac.stack(items_pc, fill_value=0)
mosaic = stackstac.mosaic(stack, nodata=0)
That will make stackstac use 0s for empty tiles, matching up with GDAL's nodata value. Then you mosaic out all the 0s.
As a sidenote, this is yet another reason to move away from VRTs, which already needs to happen: #196.
from stackstac.
Thanks!
Yes, it works as a workaround: it is easy to get a fill_value/nodata for elevation values (I have seen -9999 sometimes), so no problem.
from stackstac.
FYI @lhcorralo, the fix is now released in 0.5.0, so you should be able to go back to using mosaic
. Thanks for the great bug report!
from stackstac.
Related Issues (20)
- stackstac.stack doesn't read overviews HOT 12
- Parallelize reads for timeseries HOT 3
- why can't epsg be cast to int as before? (change #188 broke my code) HOT 3
- possible to inadvertently drop item when `proj:bbox` is much larger than target bbox in another projection HOT 2
- stackstac 0.4.3 to 0.4.4 creating an issue HOT 5
- Stackstac.stack provides shifted pixel coordinnates compare to qgis/rioxarray HOT 5
- Adapting Basic Example for L1C Sentinel-2 Products HOT 2
- Pandas UserWarning: The argument 'infer_datetime_format' is deprecated HOT 1
- Can't leverage custom projection like modis ? HOT 5
- Add jupyter-server-proxy to `viz` dependencies
- Multidimensional coordinnates is not supported HOT 2
- README example raises `DoesNotConformTo` HOT 3
- Only support pystac? HOT 1
- Slicing KeyError HOT 2
- High RAM use during stackstac.stack(items, epsg=item_crs) HOT 2
- Basic example SSLCertVerificationError HOT 12
- Accessing VZA and SZA bands? HOT 1
- Error for assests with multiple bands is not raised correctly
- Stack Contains NaT in Time Field HOT 7
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 stackstac.