deeplycloudy / xlma-python

A future, Python-based version of xlma?
MIT License
6 stars 6 forks source link

Missing variable attributes when reading multiple files #11

Open deeplycloudy opened 4 years ago

deeplycloudy commented 4 years ago

When reading multiple LMA datasets with lma_dataset, t = pyxlma.lmalib.io.read.dataset(list_of_files), they are concatenated but in the process the attributes of some variables are dropped.

from pyxlma.lmalib.io.cf_netcdf import compare_attributes
compare_attributes(lma_dataset)

gives

network_center_latitude -- Template: {'long_name': 'Latitude of network center used in event processing', 'units': 'degrees_north', 'standard_name': 'latitude'}  -- Actual: {}
network_center_longitude -- Template: {'long_name': 'Longitude of network center used in event processing', 'units': 'degrees_east', 'standard_name': 'longitude'}  -- Actual: {}
network_center_altitude -- Template: {'long_name': 'Altitude of network center used in event processing', 'units': 'meter', 'standard_name': 'altitude'}  -- Actual: {}
station_latitude -- Template: {'_FillValue': nan, 'valid_range': [-90.0, 90.0], 'units': 'degrees_north', 'standard_name': 'latitude'}  -- Actual: {}
station_longitude -- Template: {'_FillValue': nan, 'valid_range': [-180.0, 180.0], 'units': 'degrees_east', 'standard_name': 'longitude'}  -- Actual: {}
station_altitude -- Template: {'_FillValue': nan, 'valid_range': [-100.0, 40000.0], 'units': 'meters', 'standard_name': 'altitude', 'positive': 'up'}  -- Actual: {}
station_event_fraction -- Template: {'_FillValue': nan, 'long_name': 'Fraction of events to which this station contributed', 'valid_range': [0.0, 100.0], 'units': 'percent'}  -- Actual: {}
station_power_ratio -- Template: {'_FillValue': nan, 'long_name': '<P/P_m>'}  -- Actual: {}
event_time -- Template: {'_FillValue': nan, 'standard_name': 'time', 'long_name': 'Time of event', 'units': 'seconds since 2018-09-13 00:00:00 +00:00'}  -- Actual: {'_FillValue': nan, 'standard_name': 'time', 'long_name': 'Time of event'}
event_stations -- Template: {'_FillValue': 0, 'long_name': 'Number of contributing stations ', 'coordinates': 'event_id event_time event_latitude event_longitude', 'valid_range': [5, 255]}  -- Actual: {'_FillValue': 0, 'long_name': 'Number of contributing stations ', 'coordinates': 'event_id event_time event_latitude event_longitude', 'valid_range': [6, 255]}
event_id -- Template: {'_FillValue': 18446744073709551615, 'parent_id': 'event_parent_flash_id', 'parent': 'flash_id', 'cf_role': 'tree_id'}  -- Actual: {}
station_code -- Template: {'_FillValue': ' ', 'long_name': 'LMA station identifier and event station mask order'}  -- Actual: {}

Note the empty "Actual" dictionaries.