Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
|
View / edit / reply to this conversation on ReviewNB jsignell commented on 2026-03-12T16:26:49Z We can actually go ahead and delete this note! |
|
View / edit / reply to this conversation on ReviewNB jsignell commented on 2026-03-12T16:26:50Z Is setting the dtype really required? That feels odd. Also is it possible to just use tylanderson commented on 2026-03-12T17:59:45Z For dtype, in this case the STAC item defines nodata as inf, but the data is actually int16. I kept dtype as float32 to allow masking that data in xarray.
For chunks, I thought I recalled that you could pass "auto" to chunks, but looking at the latest docs, they want a dict that has each dim and a chunk size or auto for each jsignell commented on 2026-03-12T20:02:36Z Ok! Thanks for looking into it. That's a bummer that it's more verbose and you need to know the coords names before opening the data :(
|
|
View / edit / reply to this conversation on ReviewNB jsignell commented on 2026-03-12T16:26:51Z Line #2. from odc.algo import mask_cleanup, to_float these two look unused |
|
View / edit / reply to this conversation on ReviewNB jsignell commented on 2026-03-12T16:26:52Z Line #7. data = data.where(data != data.nodata) Is this necessary? tylanderson commented on 2026-03-12T18:13:02Z odc.stac won't generate masked / fill nodata with NaN while loading, so it's expected users do this (unlike something like rioxarray with mask_and_scale). In this case, replacing nodata with NaN allows plotting cleanly
jsignell commented on 2026-03-12T20:03:19Z Ok cool cool. Thanks for explaining. |
|
View / edit / reply to this conversation on ReviewNB jsignell commented on 2026-03-12T16:26:53Z Update the text here to make it clear that the data is already clipped coming out of |
|
View / edit / reply to this conversation on ReviewNB jsignell commented on 2026-03-12T16:26:54Z Remove this section since the data is already clipped. tylanderson commented on 2026-03-12T18:06:03Z This will mask the data outside of the polgyon itself, while above it just limits the data by the bbox of the polygon. I think it's nice to have an example of reducing the initial array via bbox/geopolygon etc, but I could add a comment above to make clear the difference
|
| @@ -107,7 +107,7 @@ | |||
| "# include all your imports in this cell\n", | |||
There was a problem hiding this comment.
|
@tylanderson thanks for taking this on! In general I'd be interested in whether using |
|
For dtype, in this case the STAC item defines nodata as inf, but the data is actually int16. I kept dtype as float32 to allow masking that data in xarray.
For chunks, I thought I recalled that you could pass "auto" to chunks, but looking at the latest docs, they want a dict that has each dim and a chunk size or auto for each View entire conversation on ReviewNB |
|
This will mask the data outside of the polgyon itself, while above it just limits the data by the bbox of the polygon. I think it's nice to have an example of reducing the initial array via bbox/geopolygon etc, but I could add a comment above to make clear the difference
View entire conversation on ReviewNB |
|
odc.stac won't generate masked / fill nodata with NaN while loading, so it's expected users do this (unlike something like rioxarray with mask_and_scale). In this case, replacing nodata with NaN allows plotting cleanly
View entire conversation on ReviewNB |
For chunks = {}, I believe what this will do is load using whatever the default chunking is on the layers (this means time will always have a chunk len of 1 for example). I think in many case it could be acceptable for reading single layers |
|
Ok! Thanks for looking into it. That's a bummer that it's more verbose and you need to know the coords names before opening the data :(
View entire conversation on ReviewNB |
|
Ok cool cool. Thanks for explaining. View entire conversation on ReviewNB |
Replaces stackstac for loading data into xarray with odc-stac via
odc.stac.loadNo-data masking shown via
da.nodataandxarray.where. CRS no longer needs to be explicitly specifiedCloses #238