Input NetCDF files

Instructions and hints for beginners

Moderators: arango, robertson

Post Reply
User avatar
Site Admin
Posts: 1152
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University

Input NetCDF files

#1 Post by arango »

Recently, I had several inquires about ROMS input NetCDF files. There is a lot of software (old and new) to generate such input files. It is very difficult to write generic programs because it depends on the application. However, there is a very easy way to generate these files using CDL scripts and the NetCDF ncgen program.

The ROMS metadata design is very rich and extensive. See varinfo.dat for a list of all the variables names, units, attributes, associated time variables, and scale factors. This is an user friendly file and variable parameters can be changed very easily. As a matter of fact, some users like to change the long-name attribute to a language other than English to facilitate automatic labeling during plotting. However, for portability I recommend to use the provided field variable name.

Use the following link to download a tar file containing several CDL scripts to construct ROMS input NetCDF files:

Currently, you can find the following CDL scripts:

Code: Select all

    grd_spherical.cdl        Spherical grid NetCDF file

    ini_hydro.cdl            Initial conditions NetCDF file (hydrodynamics)
    ini_fasham.cdl           Initial conditions NetCDF file (hydrodynamics and biology)
    ini_ecosim.cdl           Initial conditions NetCDF file (hydrodynamics and bio-optics)
    ini_sed.cdl              Initial conditions NetCDF file (hydrodynamics and sediment)

    clm_ts.cdl               Temperature-Salinity climatology NetCDF file

    frc_uvstress.cdl         Forcing NetCDF file (surface momentum stresses)
    frc_fluxclm.cdl          Forcing NetCDF file (climatological heat fluxes variables)
    frc_bulk.cdl             Forcing NetCDF file (atmospheric variable for bulk fluxes)

    frc_rivers.cdl           Forcing NetCDF file (River point/sources)
    frc_tides.cdl            Forcing NetCDF file (tidal elevation and currents)

    bry_limit.cdl            Boundary NetCDF file (various time dimensions)
    bry_unlimit.cdl          Boundary NetCDF file (unlimited time dimensions)
You can easily edit any of these scripts to change NetCDF file name, change dimensions, add and remove variables, and add and modify global attributes. A NetCDF file can be created from a CDL script by typing:

ncgen -b my_file.cdl

On the other hand, a CDL script can be created from a NetCDF file by just typing:

ncdump -h > my_file.cdl

Then, you can use any program to write your data into the created NetCDF file. I usually use the MeXCDF interface of Matlab to write the processed data with just a single command line.

Notice that ROMS now allows for multiple forcing NetCDF files. See ROMS input script.

Good luck, :P

Post Reply