update apply_oe for elevation safeguard, add option for non-described sensor, using the flag "NA-%Y%m%d"
@@ -93,7 +93,7 @@ def main():
parser.add_argument('input_loc', type=str)
parser.add_argument('input_obs', type=str)
parser.add_argument('working_directory', type=str)
- parser.add_argument('sensor', type=str, choices=['ang', 'avcl', 'neon', 'prism'])
+ parser.add_argument('sensor', type=str)
parser.add_argument('--copy_input_files', type=int, choices=[0,1], default=0)
parser.add_argument('--modtran_path', type=str)
parser.add_argument('--wavelength_path', type=str)
@@ -116,6 +116,11 @@ def main():
args = parser.parse_args()
+ if args.sensor not in ['ang', 'avcl', 'neon', 'prism']:
+ if args.sensor[:3] != 'NA-':
+ raise ValueError('argument sensor: invalid choice: "NA-test" (choose from '
+ '"ang", "avcl", "neon", "prism", "NA-*")')
+
if args.copy_input_files == 1:
args.copy_input_files = True
else:
@@ -153,6 +158,9 @@ def main():
elif args.sensor == 'prism':
dt = datetime.strptime(paths.fid[3:], '%Y%m%dt%H%M%S')
dayofyear = dt.timetuple().tm_yday
+ elif args.sensor[:3] == 'NA-':
+ dt = datetime.strptime(args.sensor[3:], '%Y%m%d')
+ dayofyear = dt.timetuple().tm_yday
h_m_s, day_increment, mean_path_km, mean_to_sensor_azimuth, mean_to_sensor_zenith, valid, \
to_sensor_azimuth_lut_grid, to_sensor_zenith_lut_grid = get_metadata_from_obs(paths.obs_working_path, lut_params)
@@ -191,7 +199,7 @@ def main():
mean_latitude, mean_longitude, mean_elevation_km, elevation_lut_grid = \
get_metadata_from_loc(paths.loc_working_path, lut_params)
if args.emulator_base is not None:
- if np.any(elevation_lut_grid < 0):
+ if elevation_lut_grid is not None and np.any(elevation_lut_grid < 0):
to_rem = elevation_lut_grid[elevation_lut_grid < 0].copy()
elevation_lut_grid[ elevation_lut_grid< 0] = 0
elevation_lut_grid = np.unique(elevation_lut_grid)
@@ -352,6 +360,8 @@ class Pathnames():
logging.info('Flightline ID: %s' % self.fid)
elif args.sensor == 'neon':
self.fid = split(args.input_radiance)[-1][:21]
+ elif args.sensor[3:] == 'NA-':
+ self.fid = os.path.splitext(os.path.basename(args.input_radiance))[0]
# Names from inputs
self.aerosol_climatology = args.aerosol_climatology_path
