Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exports fail when image is entirely cloud masked (instead of returning masked output image) #15

Open
cgmorton opened this issue May 7, 2021 · 7 comments

Comments

@cgmorton
Copy link
Collaborator

cgmorton commented May 7, 2021

For Landsat images that have no clear (i.e. not cloud masked) pixels, ET export calls are failing with the following error. I think this is a result of the cold pixel calculation not working when everything is masked.

Error: Image.constant: Parameter 'value' is required.

This isn't a huge deal but it does make it difficult to ever interpolate monthly images dynamically, since a single failing image will cause the entire job to fail. In general, I think it would be better if the export worked but just returned a fully masked image.

A good example of this is the following image, that is actually mostly clear over the land but is flagged as cloud shadow in the QA_PIXEL band.
LANDSAT/LE07/C02/T1_L2/LE07_041037_20140609
https://code.earthengine.google.com/c571583a8da4243e9f27609ecc455b3b

I'm not really sure what is the best or right way to fix this. You might be able to just set some fallback values on the reduceRegion calls so that even if they return None you can still proceed with the calculation.

@cgmorton
Copy link
Collaborator Author

cgmorton commented May 7, 2021

I'm not sure what fallback values would make sense, but you can set fallback values using the ee.Dictionary().combine() call with overwrite set to False. Something like:

d_perc_top_NDVI = d_perc_top_NDVI.combine(ee.Dictionary({'ndvi_neg': 100}), overwrite=False)

@leolaipelt
Copy link
Contributor

Hi Charles,

Thanks for the feedback. About that, I'm totaly considering to use your suggestion to fixxed this, althought I'm not sure how to use .combine() as a flag that later will return a fully masked image. I believe that all images who has this issue can not be use to determine ET, since the selection of hot and cold pixels in SEBAL is an important and sensible step.

I will check with Anderson and as soon as possible I'll return with a possible solution.

@leolaipelt
Copy link
Contributor

And sorry for the late reply.

@cgmorton
Copy link
Collaborator Author

FYI, I think your code updates for this issue look good! The tests are failing because GRIDMET was just updated and the values changed slightly. I haven't been able to find out why the values changed, but in the short term, you could just change the expected test values to match the current output.

@leolaipelt
Copy link
Contributor

I checked that "Fixing issues with "Error: Image.constant: Parameter 'value' is required." is not centered only in the cold pixel calculation, but also in hot pixel and sensible heat calculations. I managed to avoid this error applyng ee.Dictionary().combine() in reduceRegion calls as you suggested (thanks for that) and apparently it worked fine.

I also compared some ET results extracted with this version and its seems not interefered in our ET estimations.

Please, let me know if its what you need. I updated model file and bumped the version.

@leolaipelt
Copy link
Contributor

Thanks! I'll check this.

@cgmorton
Copy link
Collaborator Author

I changed the reference ET test values and I'm going to test out export some of these images that are all masked to see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants