Skip to content

Commit

Permalink
Merge branch 'main' into chore-cleanup-app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaniaguam authored Mar 4, 2024
2 parents 7d8e0dc + 7169d79 commit 54033d7
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 42 deletions.
28 changes: 9 additions & 19 deletions .github/workflows/test_icesat2_tracks_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,18 @@ jobs:
run: pip install .
- name: List dependencies
run: pip list
- name: test icesat2waves app
run: |
icesat2waves --help
icesat2waves load-file --help
icesat2waves make-spectra --help
icesat2waves plot-spectra --help
icesat2waves make-iowaga-threads-prior --help
icesat2waves make-b04-angle --help # prelim name
icesat2waves define-angle --help
icesat2waves correct-separate --help # prelim name
- name: first step B01_SL_load_single_file
run: load-file --track-name 20190502052058_05180312_005_01 --batch-key SH_testSLsinglefile2 --output-dir ./work --verbose
run: icesat2waves load-file --track-name 20190502052058_05180312_005_01 --batch-key SH_testSLsinglefile2 --output-dir ./work
- name: second step make_spectra
run: make-spectra --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work --verbose
run: icesat2waves make-spectra --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work
- name: third step plot_spectra
run: plot-spectra --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work --verbose
- name: fourth step IOWAGA threads
run: make-iowaga-threads-prior --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work --verbose
run: icesat2waves plot-spectra --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work
- name: fouth step IOWAGA threads
run: icesat2waves make-iowaga-threads-prior --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work
- name: fifth step B04_angle
run: make-b04-angle --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work --verbose
run: icesat2waves make-b04-angle --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work
- name: sixth step B04_define_angle
run: define-angle --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work --verbose
run: icesat2waves define-angle --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work
- name: seventh step B06_correct_separate
run: correct-separate --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work --verbose
run: icesat2waves correct-separate --track-name SH_20190502_05180312 --batch-key SH_testSLsinglefile2 --output-dir ./work

25 changes: 12 additions & 13 deletions src/icesat2_tracks/analysis_db/A02c_IOWAGA_thredds_prior.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,8 @@
makeapp,
)

color_schemes.colormaps2(21)
matplotlib.use("Agg") # prevent plot windows from opening

dtime = 4 # in hours

# IOWAGA constants
data_url = "https://tds3.ifremer.fr/thredds/IOWAGA-WW3-FORECAST/IOWAGA-WW3-FORECAST_GLOBMULTI_GLOB-30M.xml"
dataset_key = "IOWAGA-WW3-FORECAST_GLOBMULTI_GLOB-30M_FIELD_NC_MARC_WW3-GLOB-30M"


def get_iowaga(data_url=data_url, dataset_key=dataset_key):
def get_iowaga(data_url, dataset_key):
## load WW3 data
# ECMWF hindcast
# data_url = 'https://tds3.ifremer.fr/thredds/IOWAGA-WW3-HINDCAST/IOWAGA-GLOBAL_ECMWF-WW3-HINDCAST_FULL_TIME_SERIE.xml'
Expand Down Expand Up @@ -191,14 +182,20 @@ def run_A02c_IOWAGA_thredds_prior(
track_name: str = typer.Option(..., callback=validate_track_name_steps_gt_1),
batch_key: str = typer.Option(..., callback=validate_batch_key),
ID_flag: bool = True,
data_url: str = typer.Option(data_url),
dataset_key: str = typer.Option(dataset_key),
output_dir: str = typer.Option(..., callback=validate_output_dir),
verbose: bool = False,
):
"""
TODO: add docstring
"""
color_schemes.colormaps2(21)
matplotlib.use("Agg") # prevent plot windows from opening

dtime = 4 # in hours

# IOWAGA constants
data_url = "https://tds3.ifremer.fr/thredds/IOWAGA-WW3-FORECAST/IOWAGA-WW3-FORECAST_GLOBMULTI_GLOB-30M.xml"
dataset_key = "IOWAGA-WW3-FORECAST_GLOBMULTI_GLOB-30M_FIELD_NC_MARC_WW3-GLOB-30M"

track_name, batch_key, _ = io.init_from_input(
[
Expand Down Expand Up @@ -646,7 +643,9 @@ def plot_prior(Prior, axx):
echo("done")


make_iowaga_threads_prior_app = makeapp(run_A02c_IOWAGA_thredds_prior, name="threads-prior")
make_iowaga_threads_prior_app = makeapp(
run_A02c_IOWAGA_thredds_prior, name="threads-prior"
)

if __name__ == "__main__":
make_iowaga_threads_prior_app()
79 changes: 69 additions & 10 deletions src/icesat2_tracks/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

from icesat2_tracks.analysis_db.B05_define_angle import define_angle as _define_angle

from icesat2_tracks.analysis_db.B06_correct_separate_var import run_B06_correct_separate_var as _run_correct_separate_var
from icesat2_tracks.analysis_db.B06_correct_separate_var import (
run_B06_correct_separate_var as _run_correct_separate_var,
)


from icesat2_tracks.clitools import (
Expand All @@ -48,7 +50,13 @@ def run_job(
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
analysis_func(track_name, batch_key, ID_flag, output_dir, verbose)
analysis_func(
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


@app.command(help=_loadfile.__doc__)
Expand All @@ -59,7 +67,14 @@ def load_file(
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
run_job(_loadfile, track_name, batch_key, ID_flag, output_dir, verbose)
run_job(
analysis_func=_loadfile,
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


@app.command(help=_makespectra.__doc__)
Expand All @@ -70,7 +85,14 @@ def make_spectra(
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
run_job(_makespectra, track_name, batch_key, ID_flag, output_dir, verbose)
run_job(
analysis_func=_makespectra,
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


@app.command(help=_plotspectra.__doc__)
Expand All @@ -81,7 +103,14 @@ def plot_spectra(
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
run_job(_plotspectra, track_name, batch_key, ID_flag, output_dir, verbose)
run_job(
analysis_func=_plotspectra,
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


@app.command(help=_threddsprior.__doc__)
Expand All @@ -92,7 +121,14 @@ def make_iowaga_threads_prior( # TODO: revise naming @mochell
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
run_job(_threddsprior, track_name, batch_key, ID_flag, output_dir, verbose)
run_job(
analysis_func=_threddsprior,
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


@app.command(help=_run_B04_angle.__doc__)
Expand All @@ -103,7 +139,15 @@ def make_b04_angle( # TODO: revise naming @mochell
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
run_job(_run_B04_angle, track_name, batch_key, ID_flag, output_dir, verbose)
run_job(
analysis_func=_run_B04_angle,
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


@app.command(help=_define_angle.__doc__)
def define_angle(
Expand All @@ -113,8 +157,15 @@ def define_angle(
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
run_job(_define_angle, track_name, batch_key, ID_flag, output_dir, verbose)

run_job(
analysis_func=_define_angle,
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


@app.command(help=_run_correct_separate_var.__doc__)
def correct_separate( # TODO: rename with a verb or something
Expand All @@ -124,7 +175,15 @@ def correct_separate( # TODO: rename with a verb or something
output_dir: str = validate_output_dir_opt,
verbose: bool = False,
):
run_job(_run_correct_separate_var, track_name, batch_key, ID_flag, output_dir)
run_job(
analysis_func=_run_correct_separate_var,
track_name=track_name,
batch_key=batch_key,
ID_flag=ID_flag,
output_dir=output_dir,
verbose=verbose,
)


if __name__ == "__main__":
app()

0 comments on commit 54033d7

Please sign in to comment.