NOAA-GFDL / CEFI-regional-MOM6

A repository containing essential tools, XML files, and source codes for collaborators of the Climate, Ecosystems, and Fisheries Initiative (CEFI) to conduct simulations.
Other
19 stars 16 forks source link

Add pp yamls for post processing using fre canopy #77

Closed uwagura closed 2 months ago

uwagura commented 3 months ago

This PR adds pp yaml files to allow post processing the ocean_month component of the CEFI_NWA12_COBALT_V1 experiment using fre/canopy. This initial yaml does not fully replicate the output of fre/bronx due to some differences between bronx and canopy, but it does complete post processing successfully in canopy. Some notable differences:

  1. Canopy does not yet support selecting individual variables for post processing components, so you will receive output for all variables in each component
  2. Similarly, Canopy currently doesn't support postprocessing all pp components listed in your yaml by default, it only post processes the ones that you specify in the pp_components: key
  3. pp_chunk_b must be a multiple of pp_chunk_a, so it has been set to 20 years for the purposes of this yaml
  4. Currently, in order to run analysis scripts, users have to modify a cylc config file after running the fre pp checkout command. Future versions of canopy will add the ability to specify analysis scripts using an additional yaml, so until then I've set do_analysis: false.
  5. Canopy cannot produce annualized timeseries alongside monthly ones. If annual ts are desired in addition to monthly ones, you will have to add annualized history files to the diag table in addition to the monthly ones
  6. Due to a minor bug, Canopy cannot inherit post processing components across experiments, so both MOM and Cobalt postprocessing components are currently specific in the Cobalt_postprocess yaml.
yichengt900 commented 2 months ago

@uwagura , thanks for opening this PR and making effort to bring in the new canopy fre pp within our workflow! I tried to follow your instruction and repeat your step on PPAN, however, I encountered the following error message duing the validation step:

an007:/work/ynt/develop/20240906/CEFI-regional-MOM6/yamls/NWA12_test> fre pp validate -e CEFI_NWA12_COBALT_V1 -p gfdl.ncrc5-intel22 -t prod
[INFO] app/analysis/rose-app.conf
[INFO] app/combine-statics/rose-app.conf
[INFO] app/combine-timeavgs/rose-app.conf
[INFO] app/make-timeavgs/rose-app.conf
[INFO] app/make-timeseries/rose-app.conf
[INFO] app/mask-atmos-plevel/rose-app.conf
[INFO] app/regrid-xy/rose-app.conf
[INFO] app/remap-pp-components/rose-app.conf
[INFO] app/rename-split-to-pp/rose-app.conf
[INFO] app/split-netcdf-python/rose-app.conf
[INFO] app/split-netcdf/rose-app.conf
[INFO] rose-suite.conf
WorkflowConfigError: undefined parent for pp-starter: PP-STARTER
Traceback (most recent call last):
  File "/home/fms/local/opt/fre-commands/canopy/bin/fre", line 10, in <module>
    sys.exit(fre())
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/fre/pp/frepp.py", line 67, in validate
    context.forward(validate_subtool)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 804, in forward
    return __self.invoke(__cmd, *args, **kwargs)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/fre/pp/validate.py", line 30, in validate_subtool
    return _validate_subtool(experiment, platform, target)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/site-packages/fre/pp/validate.py", line 25, in _validate_subtool
    subprocess.run(cmd, shell=True, check=True)
  File "/nbhome/fms/conda/envs/fre-cli/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'cylc validate .' returned non-zero exit status 1.

This is quite odd because I checked the CEFI_NWA12_COBALT_V1.yaml and rose-suite.conf, and they are identical. If I ignore this error, I will get the same error message when running fre pp run. My first guess is that they probably made some changes to the canopy FRE pp recently. Could you double-check that?

uwagura commented 2 months ago

@yichengt900 , it looks like pp-starter section in the ~/cylc-src/CEFI_NWA12_COBALT_V1__gfdl.ncrc5-intel22__prod/site/ppan.cylc file got deleted at some point, so cylc doesn't know what this task is, leading to the error that you received. I'll look into this and let you know when it's fixed

uwagura commented 2 months ago

@yichengt900 , the files should be fixed, feel free try again when you get the chance ( you'll have to rm -rf ~/cylc-src/CEFI_NWA12_COBALT_V1__gfdl.ncrc5-intel22__prod/ and then follow the listed steps from the beginning)