diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f59e99..c5befb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # [Unreleased] - yyyy-mm-dd ### Fixed +- dial.py to accomodate python change for nan - update hsrl.py to use py3 integer divide. fixes date parsing. - units for backscatter coeffiecient to km-1 sr-1 in output files generated with aop.py - conversion from km to m in icartt.py @@ -16,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - add configuration file for GEOS-5430 (current FP) - add a buddy check code for station observation QC - add reader for GloSSAC data +- support for HALO in hsrl.py ### Changed - use xesmf regridder to station sampling. this is more efficient that using xarray native interp @@ -106,7 +108,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Added list parsing for variables in trajectory sampler - fixed byte string bug in aeronet.py -- - use a local copy of RH in aop calculator. otherwise it overwrites when fixRH is used +- use a local copy of RH in aop calculator. otherwise it overwrites when fixRH is used ### Added - MPL reader and plot curtain - calculation of total backscatter coefficient in aop.py diff --git a/src/pyobs/dial.py b/src/pyobs/dial.py index 45e9201..699bc8f 100644 --- a/src/pyobs/dial.py +++ b/src/pyobs/dial.py @@ -6,7 +6,7 @@ import os import h5py -from numpy import ones, zeros, interp, NaN, isnan, array, ma +from numpy import ones, zeros, interp, nan as NaN, isnan, array, ma from datetime import datetime, timedelta from matplotlib.pyplot import imshow, xlabel, ylabel, title, colorbar, \ diff --git a/src/pyobs/hsrl.py b/src/pyobs/hsrl.py index db459fb..7797256 100644 --- a/src/pyobs/hsrl.py +++ b/src/pyobs/hsrl.py @@ -2,7 +2,7 @@ """ Implements Python interface to the HSRL L2 data. """ - +import os import h5py import numpy as np from datetime import datetime, timedelta @@ -79,8 +79,15 @@ 'Relative_Humidity', ) } +SDS_HALO = { + '/': ('lat', 'lon', 'time', 'z', + '1064_bsc_cloud_screened', '1064_ext', '1064_aer_dep', + '532_bsc_cloud_screened', '532_ext', '532_aer_dep'), + 'Nav_Data': ('gps_date', 'date', 'gps_alt', 'gps_lat', 'gps_lon', 'gps_time'), + 'State': ('Pressure', 'Temperature', 'Relative_Humidity') +} -NAV = ( 'Altitude','date', 'gps_date','gps_lat','gps_lon','gps_time') +NAV = ( 'Altitude','date', 'gps_date','gps_lat','gps_lon','gps_time','lat','lon','time','z') # Short names # ----------- @@ -169,7 +176,17 @@ def __init__ (self,hsrl_filename,Nav_only=False,verbose=True,freq=3.0, # Handle incosistency of date across HSRL datasets # ----------------------------------------------- - if self.nt != self.date.shape[0]: + if getattr(self, 'date', None) is None: + import re + match = re.search(r'_(\d{8})_', os.path.basename(hsrl_filename)) + if match: + dt_str = match.group(1) + # Format as MM/DD/YYYY to match HSRL convention + dates = '%s/%s/%s' % (dt_str[4:6], dt_str[6:8], dt_str[0:4]) + self.date = np.array([dates for i in range(self.nt)]) + else: + raise ValueError(f"Missing date variable and could not parse YYYYMMDD from filename: {hsrl_filename}") + elif self.nt != self.date.shape[0]: date_ = self.date[0,0] yy = int(date_)//10000 mm = (int(date_) - yy * 10000)//100