Skip to content

Commit

Permalink
Merge pull request #158 from pysat/bug/139_unique_data
Browse files Browse the repository at this point in the history
BUG: data uniqueness for GOLD
  • Loading branch information
jklenzing committed Apr 5, 2023
2 parents 2bdcd8b + 9f75981 commit b0003c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
* Bug Fixes
* Updated CDAWeb routines to allow for data stored by year/day-of-year
* Updated GOLD nmax to sort scans by time.
* Added 1 usec to GOLD nmax channel B times to ensure uniqueness
* Documentation
* Added TIMED-GUVI platform
* Added missing sub-module imports
Expand Down
24 changes: 17 additions & 7 deletions pysatNASA/instruments/ses14_gold.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,21 @@
Warnings
--------
- The cleaning parameters for the instrument are still under development.
- strict_time_flag must be set to False
The cleaning parameters for the instrument are still under development.
Note
----
In roughly 0.3% of daily files, Channel A and Channel B scans begin at the same
time. One microsecond is added to Channel B to ensure uniqueness in the xarray
index. The nominal scan rate for each channel is every 30 minutes.
Examples
--------
::
import datetime as dt
import pysat
nmax = pysat.Instrument(platform='ses14', name='gold', tag='nmax'
strict_time_flag=False)
nmax = pysat.Instrument(platform='ses14', name='gold', tag='nmax')
nmax.download(dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 31))
nmax.load(2020, 1)
Expand Down Expand Up @@ -156,9 +159,16 @@ def load(fnames, tag='', inst_id=''):
drop_meta_labels='FILLVAL')

if tag == 'nmax':
# Add time coordinate from scan_start_time
data['time'] = [dt.datetime.strptime(str(val), "b'%Y-%m-%dT%H:%M:%SZ'")
for val in data['scan_start_time'].values]
# Add time coordinate from scan_start_time.
time = [dt.datetime.strptime(str(val), "b'%Y-%m-%dT%H:%M:%SZ'")
for val in data['scan_start_time'].values]

# Add a delta of 1 microsecond for channel B.
delta_time = [1 if ch == b'CHB' else 0 for ch in data['channel'].values]
data['time'] = [time[i] + dt.timedelta(microseconds=delta_time[i])
for i in range(0, len(time))]

# Sort times to ensure monotonic increase.
data = data.sortby('time')

# Update coordinates with dimensional data
Expand Down

0 comments on commit b0003c1

Please sign in to comment.