diff --git a/.github/workflows/module_integration.yml b/.github/workflows/module_integration.yml index 8142a45e08..4b0df79061 100644 --- a/.github/workflows/module_integration.yml +++ b/.github/workflows/module_integration.yml @@ -133,3 +133,82 @@ 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 + ESMF_VERSION: "8.6.0" + + 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 esmf@${{ env.ESMF_VERSION }} +pnetcdf + + - name: Install ESMPy + run: | + . .venv/bin/activate + git clone -b v${{ env.ESMF_VERSION }} --depth 1 https://github.com/esmf-org/esmf /tmp/esmf + pushd /tmp/esmf/src/addon/esmpy + spack load esmf + python3 -m pip install . + popd + rm -r /tmp/esmf + + - name: Install Forcings Engine + run: | + . .venv/bin/activate + pushd extern/ngen-forcing + spack load esmf + python3 -m pip install . + popd + + # TODO: Store in Git or Pull? They are large files + # - 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: | + . .venv/bin/activate + 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 + diff --git a/data/forcing/forcing-engine/.gitignore b/data/forcing/forcing-engine/.gitignore new file mode 100644 index 0000000000..6154d40acd --- /dev/null +++ b/data/forcing/forcing-engine/.gitignore @@ -0,0 +1 @@ +**/*.grib2 diff --git a/data/forcing/forcing-engine/NextGen_Hyfab_v2_VPU_06_ESMF_Mesh.nc b/data/forcing/forcing-engine/NextGen_Hyfab_v2_VPU_06_ESMF_Mesh.nc new file mode 100644 index 0000000000..1f42a30311 Binary files /dev/null and b/data/forcing/forcing-engine/NextGen_Hyfab_v2_VPU_06_ESMF_Mesh.nc differ diff --git a/data/forcing/forcing-engine/config.yml b/data/forcing/forcing-engine/config.yml new file mode 100644 index 0000000000..a9f2f4797d --- /dev/null +++ b/data/forcing/forcing-engine/config.yml @@ -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 diff --git a/include/realizations/catchment/Formulation_Constructors.hpp b/include/realizations/catchment/Formulation_Constructors.hpp index 640c3abbbb..5d92d2919b 100644 --- a/include/realizations/catchment/Formulation_Constructors.hpp +++ b/include/realizations/catchment/Formulation_Constructors.hpp @@ -76,6 +76,10 @@ namespace realization { else if (forcing_config.provider == "NullForcingProvider"){ fp = std::make_shared(); } + else if (forcing_config.provider == "ForcingEngine"){ + // fp = std::make_shared(); + 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 +