ROMS metadata design

Archive of important messages sent via the ROMS mailing list

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
arango
Site Admin
Posts: 1361
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

ROMS metadata design

#1 Unread post by arango »

We keep getting posts about problems building ROMS input NetCDF files and how input metadata varinfo.dat works. I really don't see why users need to change varinfo.dat at all. If you do, you need to have a good understanding of ROMS metadata model and CF (Climate and Forecast metadata standards) compliance for NetCDF files. I have mentioned several times in this forum that examples of ROMS metadata model can be found in the distributed code in directory Data/ROMS/CDL. You will see that there are several *.cdl ASCII files. Check the README file.

Notice that you can easily edit any of these files and customize them for your application. You can change the file name, dimensions, variables, and attributes. A NetCDF file can be created by just typing:

Code: Select all

ncgen -b my_file.cdl
The varinfo.dat is well documented. For example, an entry for the boundary data looks like:

Code: Select all

'zeta_west'                                        ! Input
  'free-surface western boundary condition'
  'meter'                                          ! [m]
  'zeta_west, scalar, series'
  'zeta_time'
  'idZbry(iwest)'
  'nulvar'
  1.0d0
That is, this variable in the boundary NetCDF file is defined as:

Code: Select all

dimensions:
        xi_rho = 66 ;
        eta_rho = 194;
        zeta_time = 22 ;
...
variables:

        double zeta_time(zeta_time) ;
                zeta_time:long_name = "free-surface time" ;
                zeta_time:units = "days since 2008-01-01 00:00:00" ;
        float zeta_east(zeta_time, eta_rho) ;
                zeta_east:long_name = "free-surface eastern boundary condition" ;
                zeta_east:units = "meter" ;
                zeta_east:time = "zeta_time" ;
...
Here, the boundary variable zeta_east has a time dimension zeta_time which have a fix value of 22 in the dimension definition. Notice also, that this variable has the time attribute with a string value of zeta_time. This attribute is used in ROMS to read the associated time variable for this boundary variable (zeta_east). So the actual name of the time dimension/variable can be anything that you like, provided that you are consistent with this attribute and such time variable exists in the NetCDF file.

Alternatively, you may have:

Code: Select all

dimensions:
        xi_rho = 66 ;
        eta_rho = 194;
        bry_time = UNLIMITED ; // (22 currently)
...

variables:

        double bry_time(bry_time) ;
                bry_time:long_name = "open boundary conditions time" ;
                bry_time:units = "days since 2008-01-01 00:00:00" ;
        float zeta_east(zeta_time, eta_rho) ;
                zeta_east:long_name = "free-surface eastern boundary condition" ;
                zeta_east:units = "meter" ;
                zeta_east:time = "bry_time" ;
...
Now, the time dimension and time variable is bry_time. The time dimension is unlimited so it may grow. In this case, you just have a single time variable associated with all the boundary data. If your boundary data was derived from HyCOM, you could replace bry_time everywhere with hycom_time and it will still work if you are consistent :!: In other words, this can be any string, in any language.

How ROMS process this information?

If you check any of the ROMS/Utilility/get_*fld*.F routines, you will see the following sequence of checks on any input NetCDF file:
  • Inquire about variable associated time dimension by matching the string value of the time attribute that is specified in varinfo.dat. In the above example, it will look for zeta_time.
  • If the time dimension and associated time variable are different from the string value specified in varinfo.dat, it resets its name to the one specified in the time attribute of the input NetCDF file.
  • If unsuccessful, the input NetCDF file is not CF compliant :!: In this case, ROMS will check if any of dimensions of the variable contain the sub-string time:

    Code: Select all

                  DO i=1,n_vdim
                    IF (INDEX(TRIM(var_Dname(i)),'time').ne.0) THEN
                      Nrec=var_Dsize(i)
                    END IF
                  END DO 
  • If still unsuccessful, ROMS will issue an error and stop. This indicates that you are clueless about ROMS metadata design and need to check all the available information in this forum and the :arrow: wiki before building your input NetCDF files.

    Code: Select all

                IF (got_time.and.(Nrec.eq.0)) THEN
                  IF (Master) WRITE (stdout,10) TRIM(Tname(ifield)),        &
         &                                      TRIM(Vname(1,ifield)),      &
         &                                      TRIM(fname(ifile))
                  exit_flag=4
                  RETURN
                END IF
  • Notice that to be CF compliant, the coordinate time variable and its associated time dimension need to have the same name.

Post Reply