updates to apply_oe (inside presolve) and to actual modtran execution call in modtran.py
@@ -690,7 +690,7 @@ def get_metadata_from_loc(loc_file: str, lut_params: LUTConfig, trim_lines: int
-def build_presolve_config(paths: Pathnames, h2o_lut_grid: np.array, n_cores: int=-1):
+def build_presolve_config(paths: Pathnames, h2o_lut_grid: np.array, n_cores: int=-1, use_emp_line=0):
""" Write an isofit config file for a presolve, with limited info.
Args:
paths: object containing references to all relevant file locations
@@ -704,7 +704,7 @@ def build_presolve_config(paths: Pathnames, h2o_lut_grid: np.array, n_cores: int
radiative_transfer_config = {
"radiative_transfer_engines": {
"vswir": {
- "wavelength_file": paths.wavelength_path,
+ "engine_name": 'modtran',
"lut_path": paths.lut_h2o_directory,
"template_file": paths.h2o_template_path,
"modtran_directory": paths.modtran_path,
@@ -730,10 +730,8 @@ def build_presolve_config(paths: Pathnames, h2o_lut_grid: np.array, n_cores: int
# make isofit configuration
isofit_config_h2o = {'ISOFIT_base': paths.isofit_path,
- 'input': {'measured_radiance_file': paths.rdn_subs_path,
- 'loc_file': paths.loc_subs_path,
- 'obs_file': paths.obs_subs_path},
'output': {'estimated_state_file': paths.h2o_subs_path},
+ 'input': {},
'forward_model': {
'instrument': {'wavelength_file': paths.wavelength_path,
'integrations': NUM_INTEGRATIONS,
@@ -742,7 +740,7 @@ def build_presolve_config(paths: Pathnames, h2o_lut_grid: np.array, n_cores: int
'surface': {"surface_category": "multicomponent_surface",
'surface_file': paths.surface_working_path,
'select_on_init': True},
- 'radiative_transfer': h2o_configuration},
+ 'radiative_transfer': radiative_transfer_config},
"implementation": {
'inversion': {'windows': INVERSION_WINDOWS},
"n_cores": n_cores}
@@ -760,6 +758,17 @@ def build_presolve_config(paths: Pathnames, h2o_lut_grid: np.array, n_cores: int
if paths.rdn_factors_path:
isofit_config_h2o['input']['radiometry_correction_file'] = paths.rdn_factors_path
+ if use_emp_line == 1:
+ isofit_config_h2o['input']['measured_radiance_file'] = paths.rdn_subs_path
+ isofit_config_h2o['input']['loc_file'] = paths.loc_subs_path
+ isofit_config_h2o['input']['obs_file'] = paths.obs_subs_path
+ else:
+ isofit_config_h2o['input']['measured_radiance_file'] = paths.radiance_working_path
+ isofit_config_h2o['input']['loc_file'] = paths.loc_working_path
+ isofit_config_h2o['input']['obs_file'] = paths.obs_working_path
+
+
+
# write modtran_template
with open(paths.h2o_config_path, 'w') as fout:
fout.write(json.dumps(isofit_config_h2o, cls=SerialEncoder, indent=4, sort_keys=True))
