#956 closed upgrade (Done)

Important: Added YAML Parser Test

Reported by: arango Owned by:
Priority: major Milestone: Release ROMS/TOMS 4.2
Component: Nonlinear Version: 4.1
Keywords: Cc:

Description (last modified by arango)

The YAML Parser (ROMS/Utility/yaml_parser.F) requires features of the Fortran 2003 standard and some elements of the Fortran 2008 standard, available in modern compilers. In the past, we have reports of Users having issues compiling with older versions of gfortran or incomplete implementation of the Object-Oriented Programming (OOP) principles from the 2003 standard. Therefore, a standalone program is added (ROMS/Programs/yaml_parser_test.F) to test the compilers.

To compile and link, use the following:

ifort -o yaml_parser_test.x yaml_parser_test.F
gfortran -o yaml_parser_test.x yaml_parser_test.F

Then, to execute, use:

> yaml_parser_test.x

 Enter YAML filename:  ../../ESM/coupling_esmf.yaml

 Enter YAML filename:  ../../ESM/roms_cmeps.yaml

 Enter YAML filename:  ../External/varinfo.yaml

 Enter YAML filename:

The YAML tree dictionary and extraction are written to standard output.

Examine that program if you are interested in modern OOP Fortran code that uses CLASS objects, inheritance, and other advanced capabilities. Unfortunately, modern Fortran does not use templates like C++. Maybe they will considered in the future.

For example, for roms_cmeps.yaml, I get:

 Enter YAML filename: roms_cmeps.yaml

YAML Tree Dictinary, file: 'roms_cmeps.yaml'
==========================

L=0001 % convention: CF
L=0002 % project: FV3-ROMS CMEPS couping in the WATL Application
L=0003 % title: Hurricane Dorian Test
L=0004 % date: 2019-08-29T00:00:00Z
L=0005 % forecast_length: PT96H
L=0006 % coupling_step: 180.0d0
L=0007 % linked_grid: 1
L=0008 % ATM_component: FV3
L=0009 % DATA_component: data.nc
L=0010 % OCN_component: ROMS
L=0011 % CoupledSet: ESM_01
L=0012 % ExportState: Export_ESM_01
L=0013 % ImportState: Import_ESM_01
L=0014 % PETlayoutOption: 0
L=0015 % CouplingType: 2
L=0016 % DebugLevel: 1
L=0017 % TraceLevel: 0
L=0018 % standard_input:
L=0019 %   OCN_component: roms_watl.in
L=0020 %   ATM_component: namelist
L=0021 % state variables: [sea_surface_height_above_geoid, barotropic_sea_water_x_velocity, barotropic_sea_water_y_velocity, sea_water_x_velocity, sea_water_y_velocity, sea_water_potential_temperature, sea_water_practical_salinity]
L=0022 % export:
L=0023 %   - standard_name: sea_surface_temperature
L=0024 %     long_name: sea surface temperature
L=0025 %     short_name: SST
L=0026 %     data_variables: [temperature, time]
L=0027 %     source_units: C
L=0028 %     destination_units: K
L=0029 %     source_grid: cell_center
L=0030 %     destination_grid: cell_center
L=0031 %     add_offset: 273.15d0
L=0032 %     scale: 1.0d0
L=0033 %     debug_write: false
L=0034 %     connected_to: ROMS
L=0035 %     map_type: mapnstod
L=0036 %     map_norm: none
L=0037 % import:
L=0038 %   - standard_name: net_downward_shortwave_flux_at_sea_water_surface
L=0039 %     long_name: surface net shortwave radiation flux
L=0040 %     short_name: SWrad
L=0041 %     data_variables: [swrad, time]
L=0042 %     source_units: W m-2
L=0043 %     destination_units: W m-2
L=0044 %     source_grid: cell_center
L=0045 %     destination_grid: cell_center
L=0046 %     add_offset: 0.0d0
L=0047 %     scale: 1.0d0
L=0048 %     debug_write: false
L=0049 %     connected_to: FV3
L=0050 %     map_type: mapbilnr
L=0051 %     map_norm: none
L=0052 %   - standard_name: surface_air_pressure
L=0053 %     long_name: surface air pressure
L=0054 %     short_name: Pair
L=0055 %     data_variables: [pmsl, time]
L=0056 %     source_units: N m-2
L=0057 %     destination_units: mb
L=0058 %     source_grid: cell_center
L=0059 %     destination_grid: cell_center
L=0060 %     add_offset: 0.0d0
L=0061 %     scale: 1.0d0
L=0062 %     debug_write: false
L=0063 %     connected_to: FV3
L=0064 %     map_type: mapbilnr
L=0065 %     map_norm: none
L=0066 %   - standard_name: surface_downward_heat_flux_in_sea_water
L=0067 %     long_name: surface net heat flux
L=0068 %     short_name: shflux
L=0069 %     data_variables: [shf, time]
L=0070 %     source_units: W m-2
L=0071 %     destination_units: Celsius m s-1
L=0072 %     source_grid: cell_center
L=0073 %     destination_grid: cell_center
L=0074 %     add_offset: 0.0d0
L=0075 %     scale: 1.0d0
L=0076 %     debug_write: false
L=0077 %     connected_to: FV3
L=0078 %     map_type: mapbilnr
L=0079 %     map_norm: none
L=0080 %   - standard_name: surface_upward_water_flux
L=0081 %     long_name: surface freshwater flux (E-P)
L=0082 %     short_name: swflux
L=0083 %     data_variables: [swf, time]
L=0084 %     source_units: kg m-2 s-1
L=0085 %     destination_units: kg m-2 s-1
L=0086 %     source_grid: cell_center
L=0087 %     destination_grid: cell_center
L=0088 %     add_offset: 0.0d0
L=0089 %     scale: 1.0d0
L=0090 %     debug_write: false
L=0091 %     connected_to: FV3
L=0092 %     map_type: mapbilnr
L=0093 %     map_norm: none
L=0094 %   - standard_name: surface_downward_x_stress
L=0095 %     long_name: surface eastward wind stress
L=0096 %     short_name: sustr
L=0097 %     data_variables: [taux, time]
L=0098 %     source_units: N m-2
L=0099 %     destination_units: m-2 s-2
L=0100 %     source_grid: cell_center
L=0101 %     destination_grid: left_right_edge
L=0102 %     add_offset: 0.0d0
L=0103 %     scale: 1.0d0
L=0104 %     debug_write: false
L=0105 %     connected_to: FV3
L=0106 %     map_type: mapbilnr
L=0107 %     map_norm: none
L=0108 %   - standard_name: surface_downward_y_stress
L=0109 %     long_name: surface northward wind stress
L=0110 %     short_name: svstr
L=0111 %     data_variables: [tauy, time]
L=0112 %     source_units: N m-2
L=0113 %     destination_units: m-2 s-2
L=0114 %     source_grid: cell_center
L=0115 %     destination_grid: lower_upper_edge
L=0116 %     add_offset: 0.0d0
L=0117 %     scale: 1.0d0
L=0118 %     debug_write: false
L=0119 %     connected_to: FV3
L=0120 %     map_type: mapbilnr
L=0121 %     map_norm: none
L=0122 % bulk_fluxes import:
L=0123 %   - standard_name: net_downward_shortwave_flux_at_sea_water_surface
L=0124 %     long_name: surface shortwave radiation flux
L=0125 %     short_name: SWrad
L=0126 %     data_variables: [swrad, time]
L=0127 %     source_units: W m-2
L=0128 %     destination_units: W m-2
L=0129 %     source_grid: cell_center
L=0130 %     destination_grid: cell_center
L=0131 %     add_offset: 0.0d0
L=0132 %     scale: 1.0d0
L=0133 %     debug_write: false
L=0134 %     connected_to: FV3
L=0135 %     map_type: mapbilnr
L=0136 %     map_norm: none
L=0137 %   - standard_name: surface_net_downward_longwave_flux
L=0138 %     long_name: surface downward longwave radiation flux
L=0139 %     short_name: dLWrad
L=0140 %     data_variables: [lwrad_down, time]
L=0141 %     source_units: W m-2
L=0142 %     destination_units: W m-2
L=0143 %     source_grid: cell_center
L=0144 %     destination_grid: cell_center
L=0145 %     add_offset: 0.0d0
L=0146 %     scale: 1.0d0
L=0147 %     debug_write: false
L=0148 %     connected_to: FV3
L=0149 %     map_type: mapbilnr
L=0150 %     map_norm: none
L=0151 %   - standard_name: surface_air_pressure
L=0152 %     long_name: surface air pressure
L=0153 %     short_name: Pair
L=0154 %     data_variables: [pmsl, time]
L=0155 %     source_units: N m-2
L=0156 %     destination_units: mb
L=0157 %     source_grid: cell_center
L=0158 %     destination_grid: cell_center
L=0159 %     add_offset: 0.0d0
L=0160 %     scale: 1.0d0
L=0161 %     debug_write: false
L=0162 %     connected_to: FV3
L=0163 %     map_type: mapbilnr
L=0164 %     map_norm: none
L=0165 %   - standard_name: surface_air_temperature
L=0166 %     long_name: surface (2m) air temperature
L=0167 %     short_name: Tair
L=0168 %     data_variables: [tsfc, time]
L=0169 %     source_units: K
L=0170 %     destination_units: C
L=0171 %     source_grid: cell_center
L=0172 %     destination_grid: cell_center
L=0173 %     add_offset: -273.15d0
L=0174 %     scale: 1.0d0
L=0175 %     debug_write: false
L=0176 %     connected_to: FV3
L=0177 %     map_type: mapbilnr
L=0178 %     map_norm: none
L=0179 %   - standard_name: surface_relative_humidity
L=0180 %     long_name: surface relative humidity
L=0181 %     short_name: Qair
L=0182 %     data_variables: [rhumidity, time]
L=0183 %     source_units: percent
L=0184 %     destination_units: fraction
L=0185 %     source_grid: cell_center
L=0186 %     destination_grid: cell_center
L=0187 %     add_offset: 0.0d0
L=0188 %     scale: 0.01d0
L=0189 %     debug_write: false
L=0190 %     connected_to: FV3
L=0191 %     map_type: mapbilnr
L=0192 %     map_norm: none
L=0193 %   - standard_name: precipitation_flux
L=0194 %     long_name: precipitation rate
L=0195 %     short_name: rain
L=0196 %     data_variables: [rainfall, time]
L=0197 %     source_units: kg m-2 s-1
L=0198 %     destination_units: kg m-2 s-1
L=0199 %     source_grid: cell_center
L=0200 %     destination_grid: cell_center
L=0201 %     add_offset: 0.0d0
L=0202 %     scale: 1.0d0
L=0203 %     debug_write: false
L=0204 %     connected_to: FV3
L=0205 %     map_type: mapbilnr
L=0206 %     map_norm: none
L=0207 %   - standard_name: surface_eastward_wind
L=0208 %     long_name: surface eastward wind
L=0209 %     short_name: Uwind
L=0210 %     data_variables: [uwind, time]
L=0211 %     source_units: m s-1
L=0212 %     destination_units: m s-1
L=0213 %     source_grid: cell_center
L=0214 %     destination_grid: cell_center
L=0215 %     add_offset: 0.0d0
L=0216 %     scale: 1.0d0
L=0217 %     debug_write: false
L=0218 %     connected_to: FV3
L=0219 %     map_type: mapbilnr
L=0220 %     map_norm: none
L=0221 %   - standard_name: surface_northward_wind
L=0222 %     long_name: surface northward wind
L=0223 %     short_name: Vwind
L=0224 %     data_variables: [vwind, time]
L=0225 %     source_units: m s-1
L=0226 %     destination_units: m s-1
L=0227 %     source_grid: cell_center
L=0228 %     destination_grid: cell_center
L=0229 %     add_offset: 0.0d0
L=0230 %     scale: 1.0d0
L=0231 %     debug_write: false
L=0232 %     connected_to: FV3
L=0233 %     map_type: mapbilnr
L=0234 %     map_norm: none

Coupling Metadata Dictionary, key: 'export',
============================  File: roms_cmeps.yaml

  - standard_name:        sea_surface_temperature
    long_name:            sea surface temperature
    short_name:           SST
    data_netcdf_variable: temperature
    data_netcdf_time:     time
    source_units:         C
    destination_units:    K
    source_grid:          cell_center
    destination_grid:     cell_center
    add_offset:            2.73150000E+02
    scale:                 1.00000000E+00
    debug_write:          F
    connected:            T
    connected_to:         ROMS
    map_type:             mapnstod
    map_norm:             none

Coupling Metadata Dictionary, key: 'import',
============================  File: roms_cmeps.yaml

  - standard_name:        net_downward_shortwave_flux_at_sea_water_surface
    long_name:            surface net shortwave radiation flux
    short_name:           SWrad
    data_netcdf_variable: swrad
    data_netcdf_time:     time
    source_units:         W m-2
    destination_units:    W m-2
    source_grid:          cell_center
    destination_grid:     cell_center
    add_offset:            0.00000000E+00
    scale:                 1.00000000E+00
    debug_write:          F
    connected:            T
    connected_to:         FV3
    map_type:             mapbilnr
    map_norm:             none

  - standard_name:        surface_air_pressure
    long_name:            surface air pressure
    short_name:           Pair
    data_netcdf_variable: pmsl
    data_netcdf_time:     time
    source_units:         N m-2
    destination_units:    mb
    source_grid:          cell_center
    destination_grid:     cell_center
    add_offset:            0.00000000E+00
    scale:                 1.00000000E+00
    debug_write:          F
    connected:            T
    connected_to:         FV3
    map_type:             mapbilnr
    map_norm:             none

  - standard_name:        surface_downward_heat_flux_in_sea_water
    long_name:            surface net heat flux
    short_name:           shflux
    data_netcdf_variable: shf
    data_netcdf_time:     time
    source_units:         W m-2
    destination_units:    Celsius m s-1
    source_grid:          cell_center
    destination_grid:     cell_center
    add_offset:            0.00000000E+00
    scale:                 1.00000000E+00
    debug_write:          F
    connected:            T
    connected_to:         FV3
    map_type:             mapbilnr
    map_norm:             none

  - standard_name:        surface_upward_water_flux
    long_name:            surface freshwater flux (E-P)
    short_name:           swflux
    data_netcdf_variable: swf
    data_netcdf_time:     time
    source_units:         kg m-2 s-1
    destination_units:    kg m-2 s-1
    source_grid:          cell_center
    destination_grid:     cell_center
    add_offset:            0.00000000E+00
    scale:                 1.00000000E+00
    debug_write:          F
    connected:            T
    connected_to:         FV3
    map_type:             mapbilnr
    map_norm:             none

  - standard_name:        surface_downward_x_stress
    long_name:            surface eastward wind stress
    short_name:           sustr
    data_netcdf_variable: taux
    data_netcdf_time:     time
    source_units:         N m-2
    destination_units:    m-2 s-2
    source_grid:          cell_center
    destination_grid:     left_right_edge
    add_offset:            0.00000000E+00
    scale:                 1.00000000E+00
    debug_write:          F
    connected:            T
    connected_to:         FV3
    map_type:             mapbilnr
    map_norm:             none

  - standard_name:        surface_downward_y_stress
    long_name:            surface northward wind stress
    short_name:           svstr
    data_netcdf_variable: tauy
    data_netcdf_time:     time
    source_units:         N m-2
    destination_units:    m-2 s-2
    source_grid:          cell_center
    destination_grid:     lower_upper_edge
    add_offset:            0.00000000E+00
    scale:                 1.00000000E+00
    debug_write:          F
    connected:            T
    connected_to:         FV3
    map_type:             mapbilnr
    map_norm:             none

Change History (1)

comment:1 by arango, 11 months ago

Description: modified (diff)
Resolution: Done
Status: newclosed
Note: See TracTickets for help on using tickets.