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

order_vars subsetting command error #145

Closed
JohnnyRyan1 opened this issue Oct 22, 2020 · 4 comments · Fixed by #155 or #153
Closed

order_vars subsetting command error #145

JohnnyRyan1 opened this issue Oct 22, 2020 · 4 comments · Fixed by #155 or #153

Comments

@JohnnyRyan1
Copy link

I have had trouble subsetting ICESat-2 data (ATL07) over the last few days. The code below worked a few weeks ago:

# Import
import icepyx as ipx

# Earthdata Login credentials
earthdata_uid = 'xxx'
email = 'xxx@xxx.edu'

# Define product, area and time of interest
short_name = 'ATL07'
spatial_extent = [-81, 68, -45, 85]
date_range = ['2019-04-09','2019-04-13']

# Produce data object
region_a = ipx.Query(short_name, spatial_extent, date_range)

# Search for available granules and provide basic summary info about them
region_a.avail_granules()

# Provide EarthData login details
region_a.earthdata_login(earthdata_uid, email)

# Subset variables
region_a.order_vars.append(var_list=['height_segment_height','height_segment_ssh_flag',
                                     'height_segment_quality','height_segment_surface_error_est',
                                     'height_segment_length_seg', 'cycle_number',
                                     'rgt','seg_dist_x', 'latitude','longitude', 'delta_time'])
region_a.subsetparams(Coverage=region_a.order_vars.wanted)

# Place the order
region_a.order_granules()

# Downlod granules
path = '/path/to/folder/'
region_a.download_granules(path)

When I try the region_a.order_vars command I get the following error:

Traceback (most recent call last):

  File "/home/johnny/Documents/Uummannaq_ICESat-2/Scripts/1_ATL07_Download.py", line 34, in <module>
    region_a.order_vars.append(var_list=['height_segment_height','height_segment_ssh_flag',

  File "/home/johnny/anaconda3/envs/icesat2/lib/python3.8/site-packages/icepyx/core/variables.py", line 406, in append
    vgrp, allpaths = self.avail(options=True, internal=True)

  File "/home/johnny/anaconda3/envs/icesat2/lib/python3.8/site-packages/icepyx/core/variables.py", line 94, in avail
    self._avail = is2ref._get_custom_options(

  File "/home/johnny/anaconda3/envs/icesat2/lib/python3.8/site-packages/icepyx/core/is2ref.py", line 86, in _get_custom_options
    normalproj_vals.append(normalproj[0]["normalProj"])

KeyError: 'normalProj'
@asteiker
Copy link
Collaborator

It looks like something may have changed with the service metadata we leverage at NSIDC to surface service options so this normalProj value included in that service xml is no longer there. I'll update the issue once I have more information.

@asteiker
Copy link
Collaborator

I have a fix (fix-normalproj branch) in my fork but I did this based off of master since I wasn't sure if this should be merged as a hot fix prior to merging into development. Otherwise I can create a new branch and make updates in is2ref.py as opposed to is2class.py. @JessicaS11 or others involved in active development, if you have any guidance on this, please let me know. Thanks!

@JessicaS11
Copy link
Member

Thanks for writing a fix, @asteiker! We don't yet have an "official" hotfix workflow, but if you submit a PR to development then we can can do a minor update to master to get the other items sitting on development through. Either way, I'd check that your fork is up-to-date, because the current master shouldn't have anything except a deprecation warning in is2class.py.

@icetianli
Copy link
Contributor

icetianli commented Nov 23, 2020

Just caught the same issue here when trying to access the variable list with show_custom_options and order_vars:

/anaconda3/envs/lt/lib/python3.6/site-packages/icepyx/core/is2ref.py in _get_custom_options(session, dataset, version)
     84     normalproj = [Projections.attrib for Projections in root.iter("Projections")]
     85     normalproj_vals = []
---> 86     normalproj_vals.append(normalproj[0]["normalProj"])
     87     format_proj = normalproj_vals[0].split(",")
     88     format_proj.remove("")

KeyError: 'normalProj'

Looks like the "normalProj" no longer exists in 'normalproj' anymore...

@JessicaS11 JessicaS11 linked a pull request Dec 1, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants