Skip to content

Commit

Permalink
#83 Add option to save binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
dostuffthatmatters committed Jan 6, 2024
1 parent 23d0e74 commit 15c3590
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/config.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"retrieval": {
"general": {
"max_process_count": 9,
"ifg_file_regex": "^$(SENSOR_ID)$(DATE).*\\.\\d+$"
"ifg_file_regex": "^$(SENSOR_ID)$(DATE).*\\.\\d+$",
"store_binary_spectra": false
},
"ifg_file_permissions": {
"fail_on_permission_error": true,
Expand Down
13 changes: 13 additions & 0 deletions src/retrieval/session/move_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,19 @@ def run(
shutil.copytree(output_src_dir, output_dst)
shutil.rmtree(output_src_dir)

# (OPTIONAL) STORE BINARY SPECTRA

if config.retrieval.general.store_binary_spectra:
if session.retrieval_algorithm in ["proffast-2.2", "proffast-2.3"]:
shutil.copytree(
os.path.join(
session.ctn.data_output_path, "analysis",
f"{session.ctx.sensor_id}_SN{session.ctx.serial_number:03d}",
session.ctx.from_datetime.strftime("%y%m%d"), "cal"
),
os.path.join(output_dst, "binary_spectra"),
)

# STORE AUTOMATION LOGS

shutil.copyfile(
Expand Down
5 changes: 5 additions & 0 deletions src/types/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ class RetrievalGeneralConfig(pydantic.BaseModel):
r"^$(SENSOR_ID)$(DATE).*\.nc$",
],
)
store_binary_spectra: bool = pydantic.Field(
...,
description=
"Whether to store the binary spectra files. These are the files that are used by the retrieval algorithm. They are not needed for the output files, but can be useful for debugging.",
)


class RetrievalIfgFilePermissionsConfig(pydantic.BaseModel):
Expand Down

0 comments on commit 15c3590

Please sign in to comment.