Comments (5)
FYI Element 84 is aware about these confusions and announced aligning processing baseline and metadata in the coming months :)
from stackstac.
It should be due to the fact that the newest version applies automatically offset and scale to the data, so that you get the reflectance value and not the digital number. However, in this case there seems to be an issue, since the offset has been introduced with data starting from 2023 onwards.
Did you inspect the Items returned by your query checking the scale and offset values in them?
Related issues to the new processing baseline 4.0 which introduced the offset:
Element84/earth-search#9
Element84/earth-search#23
from stackstac.
Ah ok, I see! I did not see the addition of the default rescale=True to stack(). We had our own rescaling in place, so this was a breaking change.
Looking at the first item in the query above, it has s2:processing_baseline = 05.00 so the offset should be applied. The property earthsearch:boa_offset_applied = True. However, raster:bands offset=-0.1. So if stackstac is using the raster:bands property, then it looks like it is wrong for this item. You could use earthsearch:boa_offset_applied but I suppose that is unique the Element-84 STAC.
In our own processing, we have been using the earthsearch:boa_offset_applied. It does complicate things as you have to check both the processing baseline, and whether earthsearch:boa_offset_applied exists and is False for a given item. The property doesn't exist for some items, in which case it becomes None instead of False after calling stack().
from stackstac.
Setting rescale=False gives you the correct DN value. So, as you understood, the issue is with the Element84 metadata.
import stackstac
from pystac_client import Client
geom = {'type': 'Polygon',
'coordinates': [[(-126.37, 50.43),
(-126.35, 50.43),
(-126.35, 50.45),
(-126.37, 50.45),
(-126.37, 50.43)]]}
start_date = '2020-07-01'
end_date = '2020-07-03'
url = "https://earth-search.aws.element84.com/v1"
cat = Client.open(url)
date_query = start_date+'/'+end_date
params = {
"intersects": geom,
"collections": ["sentinel-2-l2a"],
"datetime": date_query,}
search = cat.search(**params)
items = search.item_collection()
stack = stackstac.stack(
items,
assets=['blue'],
bounds_latlon=[-126.37,50.43,-126.35,50.45],
resolution=10,
epsg=32609,
rescale=False
)
print(stack[0,0,0,0].to_numpy())
> 3176.0
from stackstac.
Great, thanks for the replies! I'll close the issue
from stackstac.
Related Issues (20)
- Black stripes on mosaicking HOT 3
- 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 6
- Dimension names from cube:dimensions HOT 1
- NetCDF Time Dimension HOT 1
- Create stac objects from stackstac xarray HOT 1
- Error using .sel on time index if timestamp not in np.datetime64
- 'bounds' is messing up the x, y coordinnates
- "errors_as_nodata" not working correctly HOT 1
- Could logging be disabled for skipping VRT
- Stacking local assets - slow performance
- Handle empty input better
- issue with numpy 2.0.0
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.