-
Notifications
You must be signed in to change notification settings - Fork 215
Ocean/ice product generation for GFS and GEFS #2286
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
Changes from 21 commits
a8e12f6
b862705
9f62533
9f4533a
d7e00b2
90fab15
e9de66f
3b54968
b89f539
43232fc
76d09bc
f116a32
33dae8f
cd7b7be
c922dea
fa610ed
552bb7b
e7d8468
a4d850c
c619784
d1d415f
6525773
3a27424
82494f0
e387208
c5f84aa
5da925d
d232b4d
4abdd40
8eb84e7
2a71a27
8f2bb7c
4a5ded9
f0c76f5
1aa7197
26b0a9a
ce20bee
1b336e2
de32912
fdb9007
a7822c2
c54a4fa
97f99fc
7de1739
abea49d
30fc5f7
16fd4ee
2f4e17b
0579eb6
c9fde0e
9930d05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| source "${HOMEgfs}/ush/preamble.sh" | ||
| source "${HOMEgfs}/ush/jjob_header.sh" -e "oceanice_products" -c "base oceanice_products" | ||
|
|
||
|
|
||
| ############################################## | ||
| # Begin JOB SPECIFIC work | ||
| ############################################## | ||
|
|
||
| # Construct COM variables from templates | ||
| if [[ "${COMPONENT}" == "ocean" ]]; then YMD=${PDY} HH=${cyc} generate_com -rx COM_OCEAN_HISTORY COM_OCEAN_GRIB; fi | ||
| if [[ "${COMPONENT}" == "ice" ]]; then YMD=${PDY} HH=${cyc} generate_com -rx COM_ICE_HISTORY COM_ICE_GRIB; fi | ||
|
|
||
| ############################################################### | ||
| # Run exglobal script | ||
| "${HOMEgfs}/scripts/exglobal_oceanice_products.py" | ||
| status=$? | ||
| (( status != 0 )) && exit "${status}" | ||
|
|
||
| ############################################## | ||
| # End JOB SPECIFIC work | ||
| ############################################## | ||
|
|
||
| ############################################## | ||
| # Final processing | ||
| ############################################## | ||
| if [[ -e "${pgmout}" ]]; then | ||
| cat "${pgmout}" | ||
| fi | ||
|
|
||
| ########################################## | ||
| # Remove the Temporary working directory | ||
| ########################################## | ||
| cd "${DATAROOT}" || exit 1 | ||
| [[ "${KEEPDATA:-NO}" == "NO" ]] && rm -rf "${DATA}" | ||
|
|
||
|
|
||
| exit 0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| source "${HOMEgfs}/ush/preamble.sh" | ||
|
|
||
| ############################################################### | ||
| ## ocean ice products driver script | ||
| ## FHRLST : forecast hour list to post-process (e.g. f000, f000_f001_f002, ...) | ||
| ############################################################### | ||
|
|
||
| # Source FV3GFS workflow modules | ||
| . "${HOMEgfs}/ush/load_fv3gfs_modules.sh" | ||
| status=$? | ||
| if (( status != 0 )); then exit "${status}"; fi | ||
|
|
||
| ############################################################### | ||
| # setup python path for workflow utilities and tasks | ||
| wxflowPATH="${HOMEgfs}/ush/python:${HOMEgfs}/ush/python/wxflow/src" | ||
| PYTHONPATH="${PYTHONPATH:+${PYTHONPATH}:}${wxflowPATH}" | ||
| export PYTHONPATH | ||
|
|
||
| export job="oceanice_products" | ||
| export jobid="${job}.$$" | ||
|
|
||
| ############################################################### | ||
| # shellcheck disable=SC2153,SC2001 | ||
| IFS='_' read -ra fhrs <<< "${FHRLST//f}" # strip off the 'f's and convert to array | ||
|
|
||
| #--------------------------------------------------------------- | ||
| # Execute the JJOB | ||
| for fhr in "${fhrs[@]}"; do | ||
| export FORECAST_HOUR=$(( 10#${fhr} )) | ||
| "${HOMEgfs}/jobs/JGLOBAL_OCEANICE_PRODUCTS" | ||
| status=$? | ||
| if (( status != 0 )); then exit "${status}"; fi | ||
| done | ||
|
|
||
| exit 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #! /usr/bin/env bash | ||
|
|
||
| ########## config.oceanice_products ########## | ||
|
|
||
| echo "BEGIN: config.oceanice_products" | ||
|
|
||
| # Get task specific resources | ||
| source "${EXPDIR}/config.resources" oceanice_products | ||
|
|
||
| export OCEANICEPRODUCTS_CONFIG="${HOMEgfs}/parm/post/oceanice_products.yaml" | ||
|
|
||
| # No. of forecast hours to process in a single job | ||
| export NFHRS_PER_GROUP=3 | ||
|
|
||
| echo "END: config.oceanice_products" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| ocnicepost: | ||
| executable: "ocnicepost.x" | ||
| namelist: | ||
| debug: False | ||
| fix_data: | ||
| mkdir: | ||
| - "{{ DATA }}" | ||
| copy: | ||
| - ["{{ HOMEgfs }}/exec/ocnicepost.x", "{{ DATA }}/"] | ||
| - ["{{ HOMEgfs }}/parm/post/ocnicepost.nml.jinja2", "{{ DATA }}/"] | ||
| - ["{{ HOMEgfs }}/parm/post/{{ component }}.csv", "{{ DATA }}/"] | ||
| - ["{{ HOMEgfs }}/fix/mom6/post/{{ model_grid }}/tripole.{{ model_grid }}.Bu.to.Ct.bilinear.nc", "{{ DATA }}/"] | ||
| - ["{{ HOMEgfs }}/fix/mom6/post/{{ model_grid }}/tripole.{{ model_grid }}.Cu.to.Ct.bilinear.nc", "{{ DATA }}/"] | ||
| - ["{{ HOMEgfs }}/fix/mom6/post/{{ model_grid }}/tripole.{{ model_grid }}.Cv.to.Ct.bilinear.nc", "{{ DATA }}/"] | ||
| {% for grid in product_grids %} | ||
| - ["{{ HOMEgfs }}/fix/mom6/post/{{ model_grid }}/tripole.{{ model_grid }}.Ct.to.rect.{{ grid }}.bilinear.nc", "{{ DATA }}/"] | ||
| - ["{{ HOMEgfs }}/fix/mom6/post/{{ model_grid }}/tripole.{{ model_grid }}.Ct.to.rect.{{ grid }}.conserve.nc", "{{ DATA }}/"] | ||
| - ["{{ HOMEgfs }}/fix/mom6/post/template.global.{{ grid }}.gb2", "{{ DATA }}/"] | ||
| {% endfor %} | ||
|
|
||
| nc2grib2: | ||
| script: "{{ HOMEgfs }}/ush/oceanice_nc2grib2.sh" | ||
| avg_period: "0-6" | ||
|
|
||
| ocean: | ||
| namelist: | ||
| ftype: "ocean" | ||
| maskvar: "temp" | ||
| sinvar: "sin_rot" | ||
| cosvar: "cos_rot" | ||
| angvar: "" | ||
| {% if model_grid == 'mx025' or model_grid == 'mx050' or model_grid == 'mx100' %} | ||
| ocean_levels: [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215.86945, 241.06255, 266.5239, 308.7874, 373.9288, 467.3998, 593.87915, 757.1453, 959.97325, 1204.059, 1489.9735, 1817.1455, 2183.879, 2587.3995, 3023.9285, 3488.7875, 3976.524, 4481.0625] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jiandewang is right. 225 m is missing. It should be 215 and 225.86945, not 215.86945. @aerorahul, please fix this. Thanks! levlst="5 15 25 35 45 55 65 75 85 95 105 115 125 135 145 155 165 175 185 195 205 215 225.86945 241.06255 266.5239 308.7874 373.9288 467.3998 593.87915 757.1453 959.97325 1204.059 1489.9735 1817.1455 2183.879 2587.3995 3023.9285 3488.7875 3976.524 4481.0625"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @GwenChen-NOAA. It has been fixed now. Apologies for the copy/paste error.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jiandewang @GwenChen-NOAA |
||
| {% elif model_grid == 'mx500' %} | ||
| ocean_levels: [5, 15, 25, 35, 45, 55, 65, 75, 85, 95, 105, 115, 125, 135, 145, 155, 165, 175, 185, 195, 205, 215.86945, 241.06255, 266.5239, 308.7874] | ||
| {% endif %} | ||
| data_in: | ||
| copy: | ||
| - ["{{ COM_OCEAN_HISTORY }}/{{ RUN }}.ocean.t{{ current_cycle | strftime('%H') }}z.6hr_avg.f{{ '%03d' % forecast_hour }}.nc", "{{ DATA }}/ocean.nc"] | ||
| data_out: | ||
| mkdir: | ||
| {% for grid in product_grids %} | ||
| - "{{ COM_OCEAN_GRIB }}/{{ grid }}" | ||
|
WalterKolczynski-NOAA marked this conversation as resolved.
|
||
| {% endfor %} | ||
| copy: | ||
| {% for grid in product_grids %} | ||
| - ["{{ DATA }}/ocean.{{ grid }}.grib2", "{{ COM_OCEAN_GRIB }}/{{ grid }}/{{ RUN }}.ocean.t{{ current_cycle | strftime('%H') }}z.{{ grid }}.f{{ '%03d' % forecast_hour }}.grib2"] | ||
| - ["{{ DATA }}/ocean.{{ grid }}.grib2.idx", "{{ COM_OCEAN_GRIB }}/{{ grid }}/{{ RUN }}.ocean.t{{ current_cycle | strftime('%H') }}z.{{ grid }}.f{{ '%03d' % forecast_hour }}.grib2.idx"] | ||
| {% endfor %} | ||
|
|
||
| ice: | ||
| namelist: | ||
| ftype: "ice" | ||
| maskvar: "tmask" | ||
| sinvar: "" | ||
| cosvar: "" | ||
| angvar: "ANGLET" | ||
| data_in: | ||
| copy: | ||
| - ["{{ COM_ICE_HISTORY }}/{{ RUN }}.ice.t{{ current_cycle | strftime('%H') }}z.6hr_avg.f{{ '%03d' % forecast_hour }}.nc", "{{ DATA }}/ice.nc"] | ||
| data_out: | ||
| mkdir: | ||
| {% for grid in product_grids %} | ||
| - "{{ COM_ICE_GRIB }}/{{ grid }}" | ||
|
WalterKolczynski-NOAA marked this conversation as resolved.
|
||
| {% endfor %} | ||
| copy: | ||
| {% for grid in product_grids %} | ||
| - ["{{ DATA }}/ice.{{ grid }}.grib2", "{{ COM_ICE_GRIB }}/{{ grid }}/{{ RUN }}.ice.t{{ current_cycle | strftime('%H') }}z.{{ grid }}.f{{ '%03d' % forecast_hour }}.grib2"] | ||
| - ["{{ DATA }}/ice.{{ grid }}.grib2.idx", "{{ COM_ICE_GRIB }}/{{ grid }}/{{ RUN }}.ice.t{{ current_cycle | strftime('%H') }}z.{{ grid }}.f{{ '%03d' % forecast_hour }}.grib2.idx"] | ||
| {% endfor %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import os | ||
|
|
||
| from wxflow import AttrDict, Logger, logit, cast_strdict_as_dtypedict | ||
| from pygfs.task.oceanice_products import OceanIceProducts | ||
|
|
||
| # initialize root logger | ||
| logger = Logger(level=os.environ.get("LOGGING_LEVEL", "DEBUG"), colored_log=True) | ||
|
|
||
|
|
||
| @logit(logger) | ||
| def main(): | ||
|
|
||
| config = cast_strdict_as_dtypedict(os.environ) | ||
|
|
||
| # Instantiate the OceanIce object | ||
| oceanice = OceanIceProducts(config) | ||
|
|
||
| # Pull out all the configuration keys needed to run the rest of steps | ||
| keys = ['HOMEgfs', 'DATA', 'current_cycle', 'RUN', 'NET', | ||
| 'COM_OCEAN_HISTORY', 'COM_OCEAN_GRIB', | ||
| 'COM_ICE_HISTORY', 'COM_ICE_GRIB', | ||
| 'APRUN_OCNICEPOST', | ||
| 'component', 'forecast_hour', 'valid_datetime', | ||
| 'model_grid', 'product_grids', 'oceanice_yaml'] | ||
| oceanice_dict = AttrDict() | ||
| for key in keys: | ||
| oceanice_dict[key] = oceanice.task_config[key] | ||
|
|
||
| # Initialize the DATA/ directory; copy static data | ||
| oceanice.initialize(oceanice_dict) | ||
|
|
||
| for grid in oceanice_dict.product_grids: | ||
|
|
||
| logger.info(f"Processing {grid} grid") | ||
|
|
||
| # Configure DATA/ directory for execution; prepare namelist etc. | ||
| oceanice.configure(oceanice_dict, grid) | ||
|
|
||
| # Run the oceanice post executable to interpolate and create grib2 files | ||
| oceanice.execute(oceanice_dict, grid) | ||
|
|
||
| # Copy processed output from execute | ||
| oceanice.finalize(oceanice_dict) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| main() |
| +0 −0 | modulefiles/gfsutils_hercules.intel.lua | |
| +0 −0 | modulefiles/gfsutils_jet.intel.lua | |
| +0 −0 | modulefiles/gfsutils_orion.intel.lua | |
| +0 −0 | modulefiles/gfsutils_s4.intel.lua | |
| +0 −0 | modulefiles/gfsutils_wcoss2.intel.lua | |
| +6 −6 | parm/ocnicepost/ocnicepost.nml.jinja2 | |
| +9 −10 | src/ocnicepost.fd/init_mod.F90 | |
| +9 −8 | src/ocnicepost.fd/ocnicepost.F90 | |
| +5 −5 | src/ocnicepost.fd/utils_mod.F90 | |
| +1 −1 | ush/build.sh | |
| +59 −14 | ush/detect_machine.sh | |
| +130 −135 | ush/finddate.sh | |
| +257 −0 | ush/test_finddate.sh |
Uh oh!
There was an error while loading. Please reload this page.