Skip to content
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

Add Forcing Engine CI/CD Job and Realization Config Option #764

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 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
68 changes: 68 additions & 0 deletions .github/workflows/module_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,71 @@ jobs:
. .venv/bin/activate
./cmake_build/test/test_routing_pybind
deactivate

test_forcing_engine_integration:
# TODO: Remove when integration is ready
if: false

name: Test Forcings Engine Integration
runs-on: 'ubuntu-latest'
env:
CC: mpicc
CXX: mpic++
FC: gfortran
F90: gfortran

steps:
- name: Checkout NGen
uses: actions/checkout@v4

- name: Checkout Forcings Engine
uses: actions/checkout@v4
with:
repository: NOAA-OWP/ngen-forcing
ref: master
path: extern/ngen-forcing
clean: false

- name: Set up Spack
uses: spack/setup-spack@v2
with:
buildcache: true

- name: Install Forcings Engine Dependencies
run: |
spack install parallel-netcdf
spack install netcdf-c +parallel-netcdf
spack install netcdf-fortran
spack install parallelio +pnetcdf +ncint
spack install [email protected] +pnetcdf

- name: Install ESMPy
program-- marked this conversation as resolved.
Show resolved Hide resolved
run: |
git clone -b v8.5.0 --depth 1 https://github.com/esmf-org/esmf /tmp/esmf
pushd /tmp/esmf/src/addon/esmpy
spack load esmf
python3 -m pip install .
program-- marked this conversation as resolved.
Show resolved Hide resolved
popd
rm -r /tmp/esmf

# TODO: Store in Git or Pull? They are large files
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, we could do the testing with very cut-down files that will fit in the repo more nicely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah those are the same two options I was considering -- I'm leaning toward creating cut down files and creating a simple domain

# - name: Extract Forcing GRIBs
# run: |

- name: Build NGen
uses: ./.github/actions/ngen-build
with:
targets: "test_forcings_engine"
use_python: 'ON'
timeout-minutes: 15

- name: Run Test
run: |
spack load esmf
mpirun -np 2 ./cmake_build/test/test_forcings_engine
timeout-minutes: 10

- name: Clean Up
if: always()
uses: ./.github/actions/clean-build

1 change: 1 addition & 0 deletions data/forcing/forcing-engine/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.grib2
Binary file not shown.
64 changes: 64 additions & 0 deletions data/forcing/forcing-engine/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
time_step_seconds: 3600
initial_time: 0
NWM_VERSION: 4.0
NWM_CONFIG: "medium_range"
InputForcings: [3]
InputForcingDirectories: ["data/forcing/forcing-engine/"]
InputForcingTypes: ["GRIB2"]
InputMandatory: [1]
OutputFrequency: 1
OutDir: "data/forcing/forcing-engine/"
ScratchDir: "data/forcing/forcing-engine/tmp"
compressOutput: 0
floatOutput: 0
RetroFlag: 0
AnAFlag: 0
BDateProc: -9999
EDateProc: -9999
LookBack : -9999
RefcstBDateProc: "202401170000"
RefcstEDateProc: "202401170100"
ForecastFrequency: 1
ForecastShift: 0
ForecastInputHorizons: [14400]
ForecastInputOffsets: [0]
GeogridIn: "data/forcing/forcing-engine/NextGen_Hyfab_v2_VPU_06_ESMF_Mesh.nc"
SpatialMetaIn: ""
GRID_TYPE: "hydrofabric"
NodeCoords: 'nodeCoords'
ElemCoords: 'centerCoords'
ElemID: 'element_id'
ElemConn: 'elementConn'
NumElemConn: 'numElementConn'
HGTVAR: 'Element_Elevation'
SLOPE: 'Element_Slope'
SLOPE_AZIMUTH: 'Element_Slope_Azmuith'
IgnoredBorderWidths: [0]
RegridOpt: [1]
ForcingTemporalInterpolation: [0]
TemperatureBiasCorrection: [0]
PressureBiasCorrection: [0]
HumidityBiasCorrection: [0]
WindBiasCorrection: [0]
SwBiasCorrection: [0]
LwBiasCorrection: [0]
PrecipBiasCorrection: [0]
TemperatureDownscaling: [0]
ShortwaveDownscaling: [0]
PressureDownscaling: [0]
PrecipDownscaling: [0]
HumidityDownscaling: [0]
DownscalingParamDirs: ["extern/ngen-forcing/NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/NWM_Params"]
SuppPcp: []
SuppPcpForcingTypes: ''
SuppPcpDirectories: ''
SuppPcpParamDir: ''
RegridOptSuppPcp: []
SuppPcpTemporalInterpolation: []
SuppPcpInputOffsets: []
SuppPcpMandatory: []
RqiMethod: 0
RqiThreshold: 0.9
cfsEnsNumber: ''
custom_input_fcst_freq: []
includeLQFraq: 0
4 changes: 4 additions & 0 deletions include/realizations/catchment/Formulation_Constructors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ namespace realization {
else if (forcing_config.provider == "NullForcingProvider"){
fp = std::make_shared<NullForcingProvider>();
}
else if (forcing_config.provider == "ForcingEngine"){
// fp = std::make_shared<ForcingsEngineDataProvider>();
throw std::runtime_error{"`ForcingEngine` data provider not implemented yet"};
}
else { // Some unknown string in the provider field?
throw std::runtime_error(
"Invalid formulation forcing provider configuration! identifier: \"" + identifier +
Expand Down
Loading