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

Problem selecting region that crosses the dateline (180) #111

Closed
slhowardESR opened this issue Jul 31, 2020 · 6 comments · Fixed by #113
Closed

Problem selecting region that crosses the dateline (180) #111

slhowardESR opened this issue Jul 31, 2020 · 6 comments · Fixed by #113
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@slhowardESR
Copy link

When trying to select a subsetting region that crosses the dateline, i get an error : invalid bounding box longitudes.

the basic code:

from icepyx import icesat2data as ipd
import os
import shutil
from pprint import pprint
%matplotlib inline

short_name = 'ATL06'
spatial_extent = [162.0, -78.95, -156.5, -75.7]
date_range = ['2018-10-14','2019-01-30']

region_a = ipd.Icesat2Data(short_name, spatial_extent, date_range)

error

the same code works fine for spatial_extent = [162.0, -78.95, 180 , -75.7] or spatial_extent = [-175.77, -79.2, -160.0, -75.88],

@JessicaS11 JessicaS11 added bug Something isn't working good first issue Good for newcomers labels Jul 31, 2020
@JessicaS11 JessicaS11 self-assigned this Jul 31, 2020
@JessicaS11 JessicaS11 added this to the Post Hackweek 2020 Updates milestone Jul 31, 2020
@JessicaS11
Copy link
Member

Thanks for sharing this error, @slhowardESR. This behavior is due to a validation check that wants the second longitude entered to be greater than the first longitude entered (to prevent users from entering a "backwards" bounding box). This clearly is a problem for boxes that cross the dateline, so we'll have to modify our check to include this situation.

@slhowardESR
Copy link
Author

Hi @JessicaS11 , I am using the updated version of this now, and setting up a bounding box that crosses the date line works well, however, I now have a problem with accessing the data that i think is still related to the dateline issue, but maybe not related code wise.

this part of the code I am using works fine now (if failed previously):

from icepyx import icesat2data as ipd
import os
import shutil
from pprint import pprint
%matplotlib inline

# Ross Sea
short_name = 'ATL06'
spatial_extent = [162.0, -78.95, 185, -75.7]
date_range = ['2018-10-14','2020-07-30']

region_a = ipd.Icesat2Data(short_name, spatial_extent, date_range)

print(region_a.dataset)
print(region_a.dates)
print(region_a.start_time)
print(region_a.end_time)
print(region_a.dataset_version)
print(region_a.spatial_extent)

region_a.earthdata_login('**name**','***email@esr.org')
region_a.visualize_spatial_extent()

However, it fails when I try to start accessing the data:

region_a.avail_granules()
with this error:
error

and i can't order any granules, etc

If use a different spatial extent that doesn't cross the dateline, such as spatial_extent = = [162.0, -78.95, 180, -75.7], it works fine, so I think it is still related to this dateline issue.

Let me know if I need to send any more info (or my full code) or if i need to add this as a new issue?

And sorry for delay on fully checking this (I took some time off)
And Thanks!

@JessicaS11
Copy link
Member

Hello @slhowardESR! If I enter the spatial extent (and other inputs) that you show above, spatial_extent = [162.0, -78.95, 185, -75.7], I get an invalid longitude error, as expected, because one of the longitude values is not between the NSIDC/CMR mandated [-180, 180]. If I instead enter it as -175 (spatial_extent = [162.0, -78.95, -175, -75.7]), I get that over 1000 granules are available (though I'll note that the built-in map visualization seems to plot the inverse of the bounding box, which I've got on the bug list, #117). Does this resolve your issue, or do we need to dig deeper?

@slhowardESR
Copy link
Author

Hi @JessicaS11 , if I use spatial_extent = [162.0, -78.95, -175, -75.7] I still get an error when I run: region_a = ipd.Icesat2Data(short_name, spatial_extent, date_range)
image

So, I assumed (incorrectly) that I just had to use longitude as 0-360. (and it makes sense that this doesn't work with the NSIDC site). So, if the code above is working for you, the problem is probably on my end with the new library updates/install. I will try again!

@JessicaS11
Copy link
Member

Hello @slhowardESR. Thanks for this update. Your assumption on 0-360deg inputs totally makes sense given the error you were seeing. After you git pulled the most recent development version, make sure that you pip install -e. from inside the icepyx repo. Then restart your notebook kernel (if you're working in a notebook). From the traceback, it looks like you're still working in the older version of the code, so I suspect that Python is importing the wrong version. Unfortunately, you'll have to run the pip install command each time you start up your work environment until the next release is out (hopefully this week!) and you can update the installed version.

@slhowardESR
Copy link
Author

okay - awesome. Thanks, That helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants