Skip to content

Commit

Permalink
Merge pull request #161 from landsito/gold
Browse files Browse the repository at this point in the history
Added new tags into SES14-GOLD
  • Loading branch information
jklenzing committed Apr 14, 2023
2 parents 7ccc4bf + 7d91e23 commit f3aa4ab
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This project adheres to [Semantic Versioning](https://semver.org/).
* DMSP SSUSI EDR-Aurora data
* IGS GPS (TEC and ROTI)
* TIMED GUVI
* SES-14 GOLD -- tdisk, tlimb and o2den data products added
* TIMED GUVI
* Add TIMED GUVI platform to support L1C intensity datasets.
* Type of sensor source handled by inst_id with options of
spectrograph, imaging
Expand Down
49 changes: 44 additions & 5 deletions pysatNASA/instruments/ses14_gold.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
'gold'
tag
'nmax'
'tlimb'
'tdisk'
'o2den'
Warnings
--------
Expand Down Expand Up @@ -50,15 +53,18 @@

platform = 'ses14'
name = 'gold'
tags = {'nmax': 'Level 2 Nmax data for the GOLD instrument'}
inst_ids = {'': ['nmax']}
tags = {'nmax': 'Level 2 max dens data for the GOLD instrument',
'tlimb': 'Level 2 limb temp data for the GOLD instrument',
'tdisk': 'Level 2 disk temp data for the GOLD instrument',
'o2den': 'Level 2 O2 dens data for the GOLD instrument'}
inst_ids = {'': [tag for tag in tags.keys()]}

pandas_format = False

# ----------------------------------------------------------------------------
# Instrument test attributes

_test_dates = {'': {'nmax': dt.datetime(2020, 1, 1)}}
_test_dates = {'': {tag: dt.datetime(2020, 1, 1) for tag in tags.keys()}}

# ----------------------------------------------------------------------------
# Instrument methods
Expand Down Expand Up @@ -153,12 +159,19 @@ def load(fnames, tag='', inst_id=''):
'Valid_Max': 'Valid_Max', '_FillValue': 'fill',
'FillVal': 'fill', 'TIME_BASE': 'time_base'}

if tag in ['nmax', 'tdisk', 'tlimb']:
epoch_name = 'nscans'

elif tag == 'o2den':
epoch_name = 'nevents'

data, meta = load_netcdf(fnames, pandas_format=pandas_format,
epoch_name='nscans', labels=labels,
epoch_name=epoch_name, labels=labels,
meta_translation=meta_translation,
combine_by_coords=False,
drop_meta_labels='FILLVAL')

if tag == 'nmax':
if tag == ['nmax', 'tdisk', 'tlimb']:
# 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]
Expand All @@ -182,4 +195,30 @@ def load(fnames, tag='', inst_id=''):
meta['nlons'] = {meta.labels.notes: 'Index for longitude values'}
meta['nmask'] = {meta.labels.notes: 'Index for mask values'}

elif tag == 'o2den':

# Removing extra variables
if len(data['zret'].dims) > 1:
data['zret'] = data['zret'].isel(time=0)
data['zdat'] = data['zdat'].isel(time=0)

# Add time coordinate from utc_time
data['time'] = [dt.datetime.strptime(str(val),
"b'%Y-%m-%dT%H:%M:%S.%fZ'")
for val in data['time_utc'].values]

# Add retrieval altitude values and data tangent altitude values
data = data.swap_dims({"nzret": "zret", "nzdat": "zdat"})

# Update coordinates with dimensional data
data = data.assign_coords({'zret': data['zret'],
'zdat': data['zdat'],
'n_wavelength': data['n_wavelength'],
'channel': data['channel']})
meta['time'] = {meta.labels.notes: 'Converted from time_utc'}
meta['zret'] = {meta.labels.notes: ''.join(('Index for retrieval',
' altitude values'))}
meta['zdat'] = {meta.labels.notes: ''.join(('Index for data tangent',
' altitude values'))}

return data, meta

0 comments on commit f3aa4ab

Please sign in to comment.