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

Can't export images in 2021 #16

Open
cgmorton opened this issue Jun 20, 2021 · 1 comment
Open

Can't export images in 2021 #16

cgmorton opened this issue Jun 20, 2021 · 1 comment

Comments

@cgmorton
Copy link
Collaborator

I think the problem is that the code is trying to select the CDL image that corresponds with the image year but there is not a 2021 CDL image yet. It seems like a simple fix for this would be to set clamp the year in the lc_mask function to 2008-2020.

So change this line:

year_condition = ee.Algorithms.If(ee.Number(year).lte(2007), 2008, year)

to something like this:

year_condition = ee.Number(year).max(2008).min(2020)

The problem with this fix is that this will need to be manually updated in the future. A better approach would be to get the last available CDL image year and clamp to that. I haven't tested this yet, but something like this might work for getting the max (and min) year:

year_max = ee.Date(ee.ImageCollection('USDA/NASS/CDL')
    .limit(1, 'system:time_start', false).first().get('system:time_start')).get('year')
cgmorton added a commit that referenced this issue Jun 22, 2021
At some point I will test out the code for dynamically computing the max CDL year, but hardcoding it to 2020 for now.  I'm not bumping the version number since this doesn't impact any of the actual calculations.
@cgmorton
Copy link
Collaborator Author

I made the quick fix for this issue in order to start generating images for 2021, but I'm going to leave this open until I add some tests to make sure the dynamic year computation is working correctly.

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

1 participant