-
Notifications
You must be signed in to change notification settings - Fork 4
Add marine job and make it work on HPC #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
748e868
added marine job and test for script
guillaumevernieres db54742
Merge branch 'main' into feature/marine_task
guillaumevernieres ed54327
added pytests
guillaumevernieres 21c0b88
py norms
guillaumevernieres a468fa0
added pytest to gitrunner
guillaumevernieres d3bd41b
Update ush/python/pyobsforge/task/marine_prepobs.py
guillaumevernieres bf17e68
...
guillaumevernieres 0d48782
Update ush/python/pyobsforge/task/marine_prepobs.py
guillaumevernieres e1e0674
...
guillaumevernieres b680985
wrong var name conv
guillaumevernieres 47741ac
call nc2ioda app
guillaumevernieres 7c7697c
...
guillaumevernieres eebeae1
hpc2local
guillaumevernieres 3215947
added marine gfs to xml
guillaumevernieres 9bd5b2c
works but still wip
guillaumevernieres 9947662
fixed pytest
guillaumevernieres 0b45821
updated doc
guillaumevernieres 6f58cc7
added qc to the config
guillaumevernieres 0bbd606
python paths
guillaumevernieres 868fc3f
//ized conversion
guillaumevernieres 4305507
fixed flake issues
guillaumevernieres 1cccd09
install missing lib
guillaumevernieres fc98612
wrong pytest
guillaumevernieres f74a614
fixed wrong ppn request
guillaumevernieres 862a295
addressed reviews
guillaumevernieres File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,3 +53,6 @@ __pycache__*/ | |
|
|
||
| # rocoto | ||
| *.db | ||
|
|
||
| # Ignore pytest working directory | ||
| scripts/tests/tests_output | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,42 @@ | ||
| # obsForge | ||
| Forging next generation of observation processing leveraging JEDI | ||
|
|
||
| # Clone and Build | ||
| ``` | ||
| git clone --recursive --jobs 2 https://github.com/NOAA-EMC/obsForge.git | ||
| cd obsForge | ||
| ./build.sh | ||
| ``` | ||
|
|
||
| # Tests | ||
| Load the modules if you have not yet, | ||
| ``` | ||
| module use modulefiles | ||
| module load obsforge/{hpc}.{compiler} | ||
| ``` | ||
|
|
||
| Testing the bufr to ioda converters: | ||
| ``` | ||
| cd build/obsForge | ||
| ctest | ||
| ``` | ||
|
|
||
| Testing the non-bufr to ioda converters: | ||
| ``` | ||
| cd build | ||
| ctest -R test_obsforge_util | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| # Workflow usage | ||
| ```console | ||
| source ush/of_setup.sh | ||
| setup_xml.py --config config.yaml --template obsforge_rocoto_template.xml.j2 --output obsforge.xml | ||
| ``` | ||
|
|
||
| load rocoto | ||
| ``` | ||
| module use /apps/ops/test/nco/modulefiles/core | ||
| module load rocoto | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| source "${HOMEobsforge}/ush/preamble.sh" | ||
| source "${HOMEobsforge}/ush/jjob_header.sh" | ||
|
|
||
| ############################################## | ||
| # Set variables used in the script | ||
| ############################################## | ||
|
|
||
|
|
||
| ############################################## | ||
| # Begin JOB SPECIFIC work | ||
| ############################################## | ||
|
|
||
| ############################################################### | ||
| # Run relevant script | ||
|
|
||
| EXSCRIPT=${DUMPMARINEPY:-${HOMEobsforge}/scripts/exobsforge_global_marine_dump.py} | ||
| ${EXSCRIPT} | ||
| status=$? | ||
| if [[ ${status} -ne 0 ]]; then | ||
| exit "${status}" | ||
| fi | ||
|
|
||
|
|
||
| ############################################## | ||
| # End JOB SPECIFIC work | ||
| ############################################## | ||
|
|
||
| ############################################## | ||
| # Final processing | ||
| ############################################## | ||
| if [[ -e "${pgmout}" ]] ; then | ||
| cat "${pgmout}" | ||
| fi | ||
|
|
||
| ########################################## | ||
| # Remove the Temporary working directory | ||
| ########################################## | ||
| cd "${DATAROOT}" || exit | ||
| if [[ "${KEEPDATA}" == "NO" ]]; then | ||
| rm -rf "${DATA}" | ||
| fi | ||
|
|
||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| source "${HOMEobsforge}/ush/preamble.sh" | ||
|
|
||
| ############################################################### | ||
| # Source UFSDA workflow modules | ||
| . "${HOMEobsforge}/ush/load_obsforge_modules.sh" | ||
| status=$? | ||
| if [[ ${status} -ne 0 ]]; then | ||
| exit "${status}" | ||
| fi | ||
|
|
||
| export job="marinedump" | ||
| export jobid="${job}.$$" | ||
|
|
||
| ############################################################### | ||
| # Execute the JJOB | ||
| "${HOMEobsforge}/jobs/JOBSFORGE_GLOBAL_MARINE_DUMP" | ||
| status=$? | ||
| exit "${status}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,43 @@ | ||
| obsforge: | ||
| PSLOT: obsforge | ||
| HOMEobsforge: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/mar2025/obsforge/ | ||
| SDATE: 202503160000 | ||
| EDATE: 202503170000 | ||
| COMROOT: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/obsforge/COMROOT/ | ||
| DCOMROOT: /scratch2/NCEPDEV/stmp1/Cory.R.Martin/dcom | ||
| DATAROOT: /scratch1/NCEPDEV/stmp2/Cory.R.Martin/RUNDIRS | ||
| PSLOT: realtimeobs_testing | ||
| HOMEobsforge: /work2/noaa/da/gvernier/prs/obsForge | ||
| SDATE: 202503141800 | ||
| EDATE: 202503150000 | ||
| COMROOT: /work2/noaa/da/gvernier/prs/obsForge/realtimeobs_testing/COMROOT | ||
| DCOMROOT: /work2/noaa/da/common/lfs/h1/ops/prod/dcom | ||
| DATAROOT: /work2/noaa/da/gvernier/prs/obsForge/realtimeobs_testing/RUNDIRS | ||
| SCHEDULER: slurm | ||
| ACCOUNT: da-cpu | ||
| QUEUE: batch | ||
| PARTITION: hera | ||
| QUEUE: debug | ||
| PARTITION: hercules | ||
| KEEPDATA: NO | ||
| assim_freq: 6 | ||
|
|
||
| aoddump: | ||
| platforms: ['npp', 'n20', 'n21'] | ||
| WALLTIME_AOD_DUMP: '00:30:00' | ||
| TASK_GEOM_AOD_DUMP: '1:ppn=1:tpp=1' | ||
| MEMORY_AOD_DUMP: 96GB | ||
|
|
||
| marinedump: | ||
| providers: | ||
| ghrsst: | ||
| list: | ||
| - sst_viirs_n21_l3u | ||
| - sst_viirs_n20_l3u | ||
| - sst_viirs_npp_l3u | ||
| - sst_avhrrf_ma_l3u | ||
| - sst_avhrrf_mb_l3u | ||
| - sst_avhrrf_mc_l3u | ||
| - sst_ahi_h08_l3c | ||
| - sst_abi_g17_l3c | ||
| - sst_abi_g16_l3c | ||
| qc config: | ||
| min: -2 | ||
| max: 45 | ||
| stride: 15 | ||
| min number of obs: 10 | ||
|
|
||
| WALLTIME_MARINE_DUMP: '00:30:00' | ||
| TASK_GEOM_MARINE_DUMP: '1:ppn=40:tpp=2' | ||
| MEMORY_MARINE_DUMP: 96GB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| provider: {{ provider }} | ||
| window begin: {{ window_begin | to_isotime }} | ||
| window end: {{ window_end | to_isotime }} | ||
| {% if binning_stride is defined%} | ||
| binning: | ||
| stride: {{ binning_stride }} | ||
| min number of obs: {{ binning_min_number_of_obs }} | ||
| {% endif %} | ||
| bounds: | ||
| min: {{ bounds_min }} | ||
| max: {{ bounds_max }} | ||
| output file: {{ output_file }} | ||
| {% if ocean_basin is defined %} | ||
| ocean basin: {{ ocean_basin }} | ||
| {% endif %} | ||
| input files: {{ input_files }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/usr/bin/env python3 | ||
| # exobsforge_global_marine_dump.py | ||
| # This script will collect and preprocess | ||
| # the ocean and seaice observations for | ||
| # global marine assimilation | ||
| import os | ||
|
|
||
| from wxflow import AttrDict, Logger, cast_strdict_as_dtypedict, parse_j2yaml | ||
| from pyobsforge.task.marine_prepobs import MarineObsPrep | ||
|
|
||
| # Initialize root logger | ||
| logger = Logger(level='DEBUG', colored_log=True) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
|
|
||
| # Take configuration from environment and cast it as python dictionary | ||
| config_env = cast_strdict_as_dtypedict(os.environ) | ||
|
|
||
| # Take configuration from YAML file to augment/append config dict | ||
| config_yaml = parse_j2yaml(os.path.join(config_env['HOMEobsforge'], 'parm', 'config.yaml'), config_env) | ||
| # Extract obsforge specific configuration | ||
| obsforge_dict = {} | ||
| for key, value in config_yaml['obsforge'].items(): | ||
| if key not in config_env.keys(): | ||
| obsforge_dict[key] = value | ||
|
|
||
| # Combine configs together | ||
| config = AttrDict(**config_env, **obsforge_dict) | ||
| config = AttrDict(**config, **config_yaml['marinedump']) | ||
|
|
||
| marineObs = MarineObsPrep(config) | ||
| marineObs.initialize() | ||
| marineObs.execute() | ||
| marineObs.finalize() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # tests/conftest.py | ||
| import os | ||
| import pytest | ||
|
|
||
| home_obsforge = os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")) | ||
| test_dir = os.path.join(home_obsforge, 'scripts', 'tests', 'tests_output') | ||
| run_dir = os.path.join(test_dir, 'RUNDIRS', 'obsforge') | ||
| comroot = os.path.join(test_dir, 'COMROOT') | ||
| dcomroot = os.path.join(test_dir, 'dcom') | ||
| dataroot = os.path.join(test_dir, 'RUNDIRS') | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session", autouse=True) | ||
| def set_env_vars(): | ||
| os.environ["HOMEobsforge"] = home_obsforge | ||
| pythonpath = os.environ.get("PYTHONPATH", "") | ||
| sorc_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../sorc/wxflow/src")) | ||
| os.environ["PYTHONPATH"] = f"{pythonpath}:{sorc_path}" | ||
| os.environ["PYTHONPATH"] += f":{os.path.abspath(os.path.join(os.path.dirname(__file__), '../../ush/python'))}" | ||
| os.environ["CONFIGYAML"] = os.path.abspath(os.path.join(os.path.dirname(__file__), "config.yaml")) | ||
| os.environ["DATA"] = run_dir | ||
| os.environ["COMROOT"] = comroot | ||
| os.environ["DCOMROOT"] = dcomroot | ||
| os.environ["DATAROOT"] = dataroot | ||
|
|
||
|
|
||
| @pytest.fixture(autouse=True, scope="session") | ||
| def isolate_test_output(): | ||
| test_dir = os.path.join(home_obsforge, 'scripts', 'tests', 'tests_output') | ||
| run_dir = os.path.join(test_dir, 'RUNDIRS', 'obsforge') | ||
| os.environ["DATA"] = run_dir | ||
| os.makedirs(test_dir, exist_ok=True) | ||
| os.makedirs(os.path.join(run_dir), exist_ok=True) | ||
|
|
||
| os.chdir(os.path.join(run_dir)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why start with gfs and not gdas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no reason really, just a prototype for now. I'll add gdas the next time around.