From 1b2e050c9096eb3399996f8c276f45011385ac24 Mon Sep 17 00:00:00 2001 From: Uriel Ramirez Date: Wed, 18 Sep 2024 16:37:48 -0400 Subject: [PATCH] Add documentation, use filename macro instead of harcoding length --- data_override/README.MD | 5 +++++ data_override/include/data_override.inc | 2 +- diag_manager/diag_yaml_format.md | 4 ++++ diag_manager/fms_diag_yaml.F90 | 2 +- field_manager/field_manager.F90 | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/data_override/README.MD b/data_override/README.MD index b35879edf..fd8396563 100644 --- a/data_override/README.MD +++ b/data_override/README.MD @@ -8,6 +8,7 @@ - [Converting legacy data_table to data_table.yaml](README.MD#3-converting-legacy-data_table-to-data_tableyaml) - [Examples](README.MD#4-examples) - [External Weight File Structure](README.MD#5-external-weight-file-structure) +- [Ensemble and Nest Support](README.MD#6-ensemble-and-nest-support) #### 1. YAML Data Table format: Each entry in the data_table has the following key values: @@ -200,3 +201,7 @@ variables: - weight(:,:,2) -> (i,j+1) - weight(:,:,3) -> (i+1,j) - weight(:,:,4) -> (i+1,j+1) + +#### 6. Ensemble and Nest Support + +It may be desired to have each member of an ensemble use a different forcing file. In other to support this, FMS allows for each ensemble member to have its own data_table.yaml. For example, for a run with 2 ensemble members, fms will search for data_table_ens_01.yaml and data_table_ens_02.yaml. However, if both the data_table.yaml and the data_table_ens_* files are present, the code will crash as only 1 option is allowed. Similary, each nest can have its own data_table (data_table_nest_01.yaml), but in this case FMS will not crash if both data_table_nest_01.yaml and data_table.yaml are present. The main grid will use the data_table.yaml and the first nest will use the data_table_nest_01.yaml file. \ No newline at end of file diff --git a/data_override/include/data_override.inc b/data_override/include/data_override.inc index 9e5eda0a1..c92a7e345 100644 --- a/data_override/include/data_override.inc +++ b/data_override/include/data_override.inc @@ -591,7 +591,7 @@ subroutine read_table_yaml(data_table) integer :: nentries, mentries integer :: i character(len=50) :: buffer - character(len=255) :: filename !< Name of the expected data_table.yaml + character(len=FMS_FILE_LEN) :: filename !< Name of the expected data_table.yaml integer :: file_id ! If doing and ensemble or nest run add the filename appendix (ens_XX or nest_XX) to the filename diff --git a/diag_manager/diag_yaml_format.md b/diag_manager/diag_yaml_format.md index d9e93c359..b561445fd 100644 --- a/diag_manager/diag_yaml_format.md +++ b/diag_manager/diag_yaml_format.md @@ -15,6 +15,7 @@ The purpose of this document is to explain the diag_table yaml format. - [2.6 Sub_region Section](diag_yaml_format.md#26-sub_region-section) - [3. More examples](diag_yaml_format.md#3-more-examples) - [4. Schema](diag_yaml_format.md#4-schema) +- [5. Ensemble and Nest Support](diag_yaml_format.md#5-ensemble-and-nest-support) ### 1. Converting from legacy ascii diag_table format @@ -349,3 +350,6 @@ diag_files: A formal specification of the file format, in the form of a JSON schema, can be found in the [gfdl_msd_schemas](https://github.com/NOAA-GFDL/gfdl_msd_schemas) repository on Github. + +### 5. Ensemble and Nest Support +When using nests, it may be desired for a nest to have a different file frequency or number of variables from the parent grid. This may allow users to save disk space and reduce simulations time. In order to supports, FMS allows each nest to have a different diag_table.yaml from the parent grid. For example, if running with 1 test FMS will use diag_table.yaml for the parent grid and diag_table.nest_01.yaml for the first nest Similary, each ensemble member can have its own diag_table (diag_table_ens_XX.yaml, where XX is the ensemble number). However, for the ensemble case if both the diag_table.yaml and the diag_table_ens_* files are present, the code will crash as only 1 option is allowed. \ No newline at end of file diff --git a/diag_manager/fms_diag_yaml.F90 b/diag_manager/fms_diag_yaml.F90 index 765355556..26f631414 100644 --- a/diag_manager/fms_diag_yaml.F90 +++ b/diag_manager/fms_diag_yaml.F90 @@ -382,7 +382,7 @@ subroutine diag_yaml_object_init(diag_subset_output) !! outputing data at every frequency) character(len=:), allocatable :: filename!< Diag file name (for error messages) logical :: is_instantaneous !< .True. if the file is instantaneous (i.e no averaging) - character(len=255) :: yamlfilename !< Name of the expected diag_table.yaml + character(len=FMS_FILE_LEN) :: yamlfilename !< Name of the expected diag_table.yaml if (diag_yaml_module_initialized) return diff --git a/field_manager/field_manager.F90 b/field_manager/field_manager.F90 index e9e23a336..ba2641719 100644 --- a/field_manager/field_manager.F90 +++ b/field_manager/field_manager.F90 @@ -606,7 +606,7 @@ subroutine read_field_table_yaml(nfields, table_name) logical :: fm_success !< logical for whether fm_change_list was a success logical :: subparams !< logical whether subparams exist in this iteration -character(len=255) :: filename !< Name of the expected field_table.yaml +character(len=FMS_FILE_LEN) :: filename !< Name of the expected field_table.yaml if (.not.PRESENT(table_name)) then tbl_name = 'field_table.yaml'