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

Bug in parse delimited files #337

Closed
rstoneback opened this issue Dec 20, 2019 · 7 comments · Fixed by #439
Closed

Bug in parse delimited files #337

rstoneback opened this issue Dec 20, 2019 · 7 comments · Fixed by #439
Labels
Milestone

Comments

@rstoneback
Copy link
Collaborator

Describe the bug
The _files method for dealing with delimited filenames did not work when I tried on COSMIC files.

To Reproduce
Steps to reproduce the behavior:

  1. In cosmic_gps.py replace the fixed_width filename parsing call with the delimited version, including the '.' delimiter.
  2. method produces an error

Expected behavior
Correctly parsed list

Desktop (please complete the following information):

  • OS: Max OS 10.12.6
@rstoneback rstoneback added the bug label Dec 20, 2019
@jklenzing jklenzing added this to the 2.2.0 Release milestone Dec 31, 2019
@jklenzing
Copy link
Member

Can't duplicate this in python 3.7.3 or 3.6.9.

Steps:

  1. Replace line 123 of cosmic_gps.py
stored = pysat._files.parse_fixed_width_filenames(files, format_str)

with

stored = pysat._files.parse_delimited_filenames(files, format_str, '.')
  1. in ipython:
import pysat
cosmic = pysat.Instrument(platform='cosmic', name='gps', tag='ionprf')    
cosmic.files.files  

Both running the nominal case in develop and the modified case above produce the same list of filenames.

@jklenzing
Copy link
Member

I don't see any other programs like numpy in the routines required here. Not sure if I'm missing something else.

@jklenzing
Copy link
Member

Hash ref: 84bcb06

@rstoneback
Copy link
Collaborator Author

rstoneback commented Jan 7, 2020 via email

@rstoneback
Copy link
Collaborator Author

I tried this again on the latest develop:

In [5]: gps = pysat.Instrument('cosmic', 'gps', 'ionPrf', update_files=True)

ValueError: invalid literal for int() with base 10: 'G26_2013'

/Users/russellstoneback/Code/pysat/pysat/_files.py(808)parse_delimited_filenames()
806 # convert to numpy arrays
807 for key in stored.keys():
--> 808 stored[key] = np.array(stored[key]).astype(int)
809 if len(stored[key]) == 0:
810 stored[key] = None

@jklenzing
Copy link
Member

The issues are stemming from treating the ground station ID as seconds, hence the second key being identified as 'G26_2016', a non-integer. If I remove the second assumptions from the cosmic key, the delimited files work fine.

https://cdaac-www.cosmic.ucar.edu/cdaac/cgi_bin/fileFormats.cgi?type=ionPrf

I think our efforts will be better spent on migrating cosmic to xarray for pysat 3.0.0.

@jklenzing
Copy link
Member

Closing with merge of #439 and #442

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

Successfully merging a pull request may close this issue.

2 participants