Opened 9 years ago

Closed 9 years ago

#683 closed bug (Invalid)

def_info.F flags — at Version 1

Reported by: kate Owned by: arango
Priority: trivial Milestone: Release ROMS/TOMS 3.7
Component: Nonlinear Version: 3.7
Keywords: Cc:

Description (last modified by arango)

There are some settings in def_info.F which should have this change applied:

@@ -1403,8 +1403,8 @@
 #if defined UV_VIS2 || defined UV_VIS4
       Vinfo( 1)='LuvSponge'
       Vinfo( 2)='horizontal viscosity sponge activation switch'
-      Vinfo( 9)='.FALSE.'
-      Vinfo(10)='.TRUE.'
+      Vinfo( 7)='.FALSE.'
+      Vinfo( 8)='.TRUE.'
       status=def_var(ng, model, ncid, varid, nf90_int,                  &
      &               1, (/0/), Aval, Vinfo, ncname,                     &
      &               SetParAccess = .FALSE.)

You'll know for sure which are which, but 7/8 are for true/false values.

Change History (1)

comment:1 by arango, 9 years ago

Description: modified (diff)
Resolution: Invalid
Status: newclosed
Summary: def_info flagsdef_info.F flags

Nope, the code is correct as it is. Logicals with letters are not CF compliant! So I made the change to have 0 = .FALSE. and 1 = .TRUE. long time ago. If you look at the ROMS output NetCDF you will see:

    int LuvSrc ;
        LuvSrc:long_name = "momentum point sources and sink activation switch" ;
        LuvSrc:flag_values = 0, 1 ;
        LuvSrc:flag_meanings = ".FALSE. .TRUE." ;
    int LwSrc ;
        LwSrc:long_name = "mass point sources and sink activation switch" ;
        LwSrc:flag_values = 0, 1 ;
        LwSrc:flag_meanings = ".FALSE. .TRUE." ;
    int LtracerSrc(tracer) ;
        LtracerSrc:long_name = "tracer point sources and sink activation switch" ;
        LtracerSrc:flag_values = 0, 1 ;
        LtracerSrc:flag_meanings = ".FALSE. .TRUE." ;
    int LsshCLM ;
        LsshCLM:long_name = "sea surface height climatology processing switch" ;
        LsshCLM:flag_values = 0, 1 ;
        LsshCLM:flag_meanings = ".FALSE. .TRUE." ;
    int Lm2CLM ;
        Lm2CLM:long_name = "2D momentum climatology processing switch" ;
        Lm2CLM:flag_values = 0, 1 ;
        Lm2CLM:flag_meanings = ".FALSE. .TRUE." ;
    int Lm3CLM ;
        Lm3CLM:long_name = "3D momentum climatology processing switch" ;
        Lm3CLM:flag_values = 0, 1 ;
        Lm3CLM:flag_meanings = ".FALSE. .TRUE." ;
    int LtracerCLM(tracer) ;
        LtracerCLM:long_name = "tracer climatology processing switch" ;
        LtracerCLM:flag_values = 0, 1 ;
        LtracerCLM:flag_meanings = ".FALSE. .TRUE." ;
    int LnudgeM2CLM ;
        LnudgeM2CLM:long_name = "2D momentum climatology nudging activation switch" ;
        LnudgeM2CLM:flag_values = 0, 1 ;
        LnudgeM2CLM:flag_meanings = ".FALSE. .TRUE." ;
    int LnudgeM3CLM ;
        LnudgeM3CLM:long_name = "3D momentum climatology nudging activation switch" ;
        LnudgeM3CLM:flag_values = 0, 1 ;
        LnudgeM3CLM:flag_meanings = ".FALSE. .TRUE." ;
    int LnudgeTCLM(tracer) ;
        LnudgeTCLM:long_name = "tracer climatology nudging activation switch" ;
        LnudgeTCLM:flag_values = 0, 1 ;
        LnudgeTCLM:flag_meanings = ".FALSE. .TRUE." ;
    int spherical ;
        spherical:long_name = "grid type logical switch" ;
        spherical:flag_values = 0, 1 ;
        spherical:flag_meanings = "Cartesian spherical" ;

and the respective values are:

 LuvSrc = 1 ;

 LwSrc = 0 ;

 LtracerSrc = 1, 1 ;

 LsshCLM = 0 ;

 Lm2CLM = 0 ;

 Lm3CLM = 0 ;

 LtracerCLM = 0, 0 ;

 LnudgeM2CLM = 0 ;

 LnudgeM3CLM = 0 ;

 LnudgeTCLM = 0, 0 ;

 spherical = 1 ;

It has been like this for long time. The correct syntax is to use attributes flag_values and flag_meanings. The attributes below (option_T, option_F, option_0, and option_1) are deprecated in ROMS and we use the flag_values and flag_meanings instead. See def_var.F for details.

Vinfo( 7) =>  Variable "option_T" attribute
Vinfo( 8) =>  Variable "option_F" attribute
Vinfo( 9) =>  Variable "option_0" attribute
Vinfo(10) =>  Variable "option_1" attribute

However, we still use Vinfo(7:10) but with accepted attributes flag_values and flag_meanings instead. It turns out that Vinfo(7:8) are the same that Vinfo(9:10) but are retained for the legacy code.

As a matter of fact, attributes flag_values and flag_meanings are more flexible because you can have countless possibilities.

Notice that we have now routines to read and write logicals in ROMS. See netcdf_put_lvar and netcdf_get_lvar. They are flexible enough to take integers or characters. This is a very import issue if running with parallel I/O. Character variables are very problematic and should be only present as global attributes.

Your ticket is invalid but I am leaving it to clarify this issue. You may want to correct your added variables in the NetCDF files to follow this CF compliant rule.

Note: See TracTickets for help on using tickets.