Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ jobs:
run: |
source obsdb/bin/activate
pytest ush/python/pyobsforge/tests/ --disable-warnings -v
pytest scripts/tests/ --disable-warnings -v
45 changes: 45 additions & 0 deletions jobs/JOBSFORGE_GLOBAL_MARINE_DUMP
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
20 changes: 20 additions & 0 deletions jobs/rocoto/marinedump.sh
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}"
5 changes: 5 additions & 0 deletions parm/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ aoddump:
WALLTIME_AOD_DUMP: '00:30:00'
TASK_GEOM_AOD_DUMP: '1:ppn=1:tpp=1'
MEMORY_AOD_DUMP: 96GB
marinedump:
platforms: ['npp', 'n20', 'n21']
WALLTIME_AOD_DUMP: '00:30:00'
TASK_GEOM_AOD_DUMP: '1:ppn=1:tpp=1'
MEMORY_AOD_DUMP: 96GB
36 changes: 36 additions & 0 deletions scripts/exobsforge_global_marine_dump.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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.getenv('CONFIGYAML'), 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()
34 changes: 34 additions & 0 deletions scripts/tests/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
obsforge:
PSLOT: obsforge
HOMEobsforge: ""
SDATE: 202503160000
EDATE: 202503170000
COMROOT: ./COMROOT/
DCOMROOT: ./dcom
DATAROOT: ./RUNDIRS
SCHEDULER: slurm
ACCOUNT: da-cpu
QUEUE: batch
PARTITION: hera
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:
- 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
WALLTIME_DUMP: '00:30:00'
TASK_GEOM_DUMP: '1:ppn=1:tpp=1'
MEMORY_DUMP: 96GB
24 changes: 24 additions & 0 deletions scripts/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# tests/conftest.py
import os
import pytest


@pytest.fixture(scope="session", autouse=True)
def set_env_vars():
os.environ["HOMEobsforge"] = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
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"))


@pytest.fixture(autouse=True, scope="session")
def isolate_test_output():
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')
os.makedirs(test_dir, exist_ok=True)
os.makedirs(os.path.join(run_dir), exist_ok=True)

os.chdir(os.path.join(run_dir))
Loading