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

Meta update #28

Merged
merged 6 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [0.?.?] - 2020-07-03
- Added coords from pysat.utils
- Made changes to structure to comply with updates in pysat 3.0.0
- Bug Fix
- Updated madrigal methods to simplify compound data types and enable
creation of netCDF4 files using `Instrument.to_netcdf4()`.
Expand Down
4 changes: 2 additions & 2 deletions pysatMadrigal/instruments/gnss_tec.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def load(fnames, tag=None, inst_id=None, file_type='netCDF4'):

# Fix the units for tec and dtec
if tag == 'vtec':
meta['tec'] = {meta.units_label: 'TECU'}
meta['dtec'] = {meta.units_label: 'TECU'}
meta['tec'] = {meta.labels.units: 'TECU'}
meta['dtec'] = {meta.labels.units: 'TECU'}

return data, meta
32 changes: 16 additions & 16 deletions pysatMadrigal/instruments/jro_isr.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,21 +398,21 @@ def calc_measurement_loc(inst):

# Add metadata for the new data values
bm_label = "Beam {:d} ".format(dd)
inst.meta[lat_key] = {inst.meta.units_label: 'degrees',
inst.meta.name_label: bm_label + 'latitude',
inst.meta.desc_label: bm_label + 'latitude',
inst.meta.plot_label: bm_label + 'Latitude',
inst.meta.axis_label: bm_label + 'Latitude',
inst.meta.scale_label: 'linear',
inst.meta.min_label: -90.0,
inst.meta.max_label: 90.0,
inst.meta.fill_label: np.nan}
inst.meta[lon_key] = {inst.meta.units_label: 'degrees',
inst.meta.name_label: bm_label + 'longitude',
inst.meta.desc_label: bm_label + 'longitude',
inst.meta.plot_label: bm_label + 'Longitude',
inst.meta.axis_label: bm_label + 'Longitude',
inst.meta.scale_label: 'linear',
inst.meta.fill_label: np.nan}
inst.meta[lat_key] = {inst.meta.labels.units: 'degrees',
inst.meta.labels.name: bm_label + 'latitude',
inst.meta.labels.desc: bm_label + 'latitude',
inst.meta.labels.plot: bm_label + 'Latitude',
inst.meta.labels.axis: bm_label + 'Latitude',
inst.meta.labels.scale: 'linear',
inst.meta.labels.min_val: -90.0,
inst.meta.labels.max_val: 90.0,
inst.meta.labels.fill_val: np.nan}
inst.meta[lon_key] = {inst.meta.labels.units: 'degrees',
inst.meta.labels.name: bm_label + 'longitude',
inst.meta.labels.desc: bm_label + 'longitude',
inst.meta.labels.plot: bm_label + 'Longitude',
inst.meta.labels.axis: bm_label + 'Longitude',
inst.meta.labels.scale: 'linear',
inst.meta.labels.fill_val: np.nan}

return
17 changes: 9 additions & 8 deletions pysatMadrigal/instruments/methods/madrigal.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def load(fnames, tag=None, inst_id=None, xarray_coords=[], file_type='hdf5'):
data : pds.DataFrame or xr.Dataset
A pandas DataFrame or xarray Dataset holding the data from the HDF5
file
metadata : pysat.Meta
meta : pysat.Meta
Metadata from the HDF5 file, as well as default values from pysat

Note
Expand Down Expand Up @@ -103,10 +103,11 @@ def load(fnames, tag=None, inst_id=None, xarray_coords=[], file_type='hdf5'):
unit_string = file_data[item].attrs['units']
desc_string = file_data[item].attrs['description']
labels.append(name_string)
meta[name_string.lower()] = {'long_name': name_string,
'units': unit_string,
'desc': desc_string}
# remove any metadata from xarray
meta[name_string.lower()] = {meta.labels.name: name_string,
meta.labels.units: unit_string,
meta.labels.desc: desc_string}

# Remove any metadata from xarray
file_data[item].attrs = {}

# Reset UNIX timestamp as datetime and set it as an index
Expand Down Expand Up @@ -136,9 +137,9 @@ def load(fnames, tag=None, inst_id=None, xarray_coords=[], file_type='hdf5'):
unit_string = item[3].decode('UTF-8')
desc_string = item[1].decode('UTF-8')
labels.append(name_string)
meta[name_string.lower()] = {'long_name': name_string,
'units': unit_string,
'desc': desc_string}
meta[name_string.lower()] = {meta.labels.name: name_string,
meta.labels.units: unit_string,
meta.labels.desc: desc_string}

# Add additional metadata notes. Custom attributes attached to meta
# are attached to corresponding Instrument object when pysat
Expand Down