⇐ ⇒

[CF-metadata] staggered grids

From: John Caron <caron>
Date: Sat, 09 Oct 2004 09:05:06 -0600

Heres another person trying to do staggered grids in CF.
I forgot what we decided was the right way to do it.


------- Forwarded Message

>To: support-idv at unidata.ucar.edu
>cc: rsignell at usgs.gov
>From: Rich Signell <rsignell at yahoo.com>
>Subject: how to handle staggered U & V in IDV?
>Organization: UCAR/Unidata
>Keywords: 200410081020.i98AK8UE000709

I have U and V fields from a model that uses a
Arakawa-C grid, with U values at the left and right of
a grid cell, and V values at the top and bottom. In
the NetCDF file, therefore, U and V have different
dimensions (different by 1), and different coordinate
variables (lat_u, lon_u, lon_v, lat_v).

It would be great to have a formula that averages the
U & V values to the grid point centers so that we can
create displays with co-located velocity. Is this
possible?

Here's what my file looks like:

netcdf feb2003_short {
dimensions:
        ocean_time = UNLIMITED ; // (1 currently)
        s_rho = 20 ;
        eta_u = 60 ;
        xi_u = 159 ;
        eta_v = 59 ;
        xi_v = 160 ;
        eta_rho = 60 ;
        xi_rho = 160 ;
        tracer = 2 ;
        s_w = 21 ;
        eta_psi = 59 ;
        xi_psi = 159 ;
variables:
        short u(ocean_time, s_rho, eta_u, xi_u) ;
                u:scale_factor = -1.191449e-005f ;
                u:add_offset = 0.0627047f ;
                u:coordinates = "lat_u lon_u" ;
        short v(ocean_time, s_rho, eta_v, xi_v) ;
                v:scale_factor = -1.155427e-005f ;
                v:add_offset = -0.1354672f ;
                v:coordinates = "lat_v lon_v" ;
        short salt(ocean_time, s_rho, eta_rho, xi_rho) ;
                salt:scale_factor = -0.0006029948f ;
                salt:add_offset = 19.75863f ;
                salt:coordinates = "lat_rho lon_rho" ;
        short temp(ocean_time, s_rho, eta_rho, xi_rho) ;
                temp:scale_factor = -0.0003902203f ;
                temp:add_offset = 11.19728f ;
                temp:coordinates = "lat_rho lon_rho" ;
        double Akk_bak ;
                Akk_bak:long_name = "background vertical mixing
coefficient for turbulent energy" ;
                Akk_bak:units = "meter2 second-1" ;
        double Akp_bak ;
                Akp_bak:long_name = "background vertical mixing
coefficient for length scale" ;
                Akp_bak:units = "meter2 second-1" ;
        double Akt_bak(tracer) ;
                Akt_bak:long_name = "background vertical mixing
coefficient for tracers" ;
                Akt_bak:units = "meter2 second-1" ;
        double Akv_bak ;
                Akv_bak:long_name = "background vertical mixing
coefficient for momentum" ;
                Akv_bak:units = "meter2 second-1" ;
        double Cs_r(s_rho) ;
                Cs_r:long_name = "S-coordinate stretching curves at
RHO-points" ;
                Cs_r:units = "nondimensional" ;
                Cs_r:valid_min = -1. ;
                Cs_r:valid_max = 0. ;
                Cs_r:field = "Cs_r, scalar" ;
        double Cs_w(s_w) ;
                Cs_w:long_name = "S-coordinate stretching curves at
W-points" ;
                Cs_w:units = "nondimensional" ;
                Cs_w:valid_min = -1. ;
                Cs_w:valid_max = 0. ;
                Cs_w:field = "Cs_w, scalar" ;
        double Falpha ;
                Falpha:long_name = "Power-law shape barotropic
filter parameter" ;
        double Fbeta ;
                Fbeta:long_name = "Power-law shape barotropic filter
parameter" ;
        double Fgamma ;
                Fgamma:long_name = "Power-law shape barotropic
filter parameter" ;
        double M2nudg ;
                M2nudg:long_name = "2D momentum nudging/relaxation
inverse time scale" ;
                M2nudg:units = "day-1" ;
        double M3nudg ;
                M3nudg:long_name = "3D momentum nudging/relaxation
inverse time scale" ;
                M3nudg:units = "day-1" ;
        double Tcline ;
                Tcline:long_name = "S-coordinate surface/bottom
layer width" ;
                Tcline:units = "meter" ;
        double Tnudg(tracer) ;
                Tnudg:long_name = "Tracers nudging/relaxation
inverse time scale" ;
                Tnudg:units = "day-1" ;
        double Znudg ;
                Znudg:long_name = "free-surface nudging/relaxation
inverse time scale" ;
                Znudg:units = "day-1" ;
        double Zob ;
                Zob:long_name = "bottom roughness" ;
                Zob:units = "meter" ;
        double Zos ;
                Zos:long_name = "surface roughness" ;
                Zos:units = "meter" ;
        double angle(eta_rho, xi_rho) ;
                angle:long_name = "angle between xi axis and east" ;
                angle:units = "degree" ;
        double dstart ;
                dstart:long_name = "time stamp assigned to model
initilization" ;
                dstart:units = "days since 0000-01-01 00:00:00" ;
                dstart:calendar = "365.25 days in every year" ;
        double dt ;
                dt:long_name = "size of long time-steps" ;
                dt:units = "second" ;
        double dtfast ;
                dtfast:long_name = "size of short time-steps" ;
                dtfast:units = "second" ;
        double el ;
                el:long_name = "domain length in the ETA-direction"
;
                el:units = "meter" ;
        double f(eta_rho, xi_rho) ;
                f:long_name = "Coriolis parameter at RHO-points" ;
                f:units = "second-1" ;
                f:field = "coriolis, scalar" ;
        double gamma2 ;
                gamma2:long_name = "Slipperiness parameter" ;
                gamma2:units = "nondimensional" ;
        double h(eta_rho, xi_rho) ;
                h:long_name = "bathymetry at RHO-points" ;
                h:units = "meter" ;
                h:field = "bath, scalar" ;
                h:coordinates = "lat_rho lon_rho" ;
        double hc ;
                hc:long_name = "S-coordinate parameter, critical
depth" ;
                hc:units = "meter" ;
        double lat_rho(eta_rho, xi_rho) ;
                lat_rho:long_name = "latitude of RHO-points" ;
                lat_rho:units = "degree_north" ;
                lat_rho:field = "lat_rho, scalar" ;
        double lat_u(eta_u, xi_u) ;
                lat_u:long_name = "latitude of U-points" ;
                lat_u:units = "degree_north" ;
        double lat_v(eta_v, xi_v) ;
                lat_v:long_name = "latitude of V-points" ;
                lat_v:units = "degree_north" ;
        float latent(ocean_time, eta_rho, xi_rho) ;
                latent:units = "Watts meter-2" ;
                latent:negative = "upward flux, cooling" ;
                latent:positive = "downward flux, heating" ;
                latent:time = "ocean_time" ;
                latent:field = "latent heat flux, scalar, series" ;
        double lon_rho(eta_rho, xi_rho) ;
                lon_rho:long_name = "longitude of RHO-points" ;
                lon_rho:units = "degree_east" ;
                lon_rho:field = "lon_rho, scalar" ;
        double lon_u(eta_u, xi_u) ;
                lon_u:long_name = "longitude of U-points" ;
                lon_u:units = "degree_east" ;
        double lon_v(eta_v, xi_v) ;
                lon_v:long_name = "longitude of V-points" ;
                lon_v:units = "degree_east" ;
        float lwrad(ocean_time, eta_rho, xi_rho) ;
                lwrad:units = "Watts meter-2" ;
                lwrad:negative = "upward flux, cooling" ;
                lwrad:positive = "downward flux, heating" ;
                lwrad:time = "ocean_time" ;
                lwrad:field = "longwave radiation, scalar, series" ;
        double mask_psi(eta_psi, xi_psi) ;
                mask_psi:long_name = "mask on psi-points" ;
                mask_psi:option_0 = "land" ;
                mask_psi:option_1 = "water" ;
        double mask_rho(eta_rho, xi_rho) ;
                mask_rho:long_name = "mask on RHO-points" ;
                mask_rho:option_0 = "land" ;
                mask_rho:option_1 = "water" ;
                mask_rho:option(0) = "land" ;
                mask_rho:option(1) = "water" ;
        double mask_u(eta_u, xi_u) ;
                mask_u:long_name = "mask on U-points" ;
                mask_u:option_0 = "land" ;
                mask_u:option_1 = "water" ;
                mask_u:option(0) = "land" ;
                mask_u:option(1) = "water" ;
        double mask_v(eta_v, xi_v) ;
                mask_v:long_name = "mask on V-points" ;
                mask_v:option_0 = "land" ;
                mask_v:option_1 = "water" ;
                mask_v:option(0) = "land" ;
                mask_v:option(1) = "water" ;
        int navg ;
                navg:long_name = "number of time-steps between
time-averaged records" ;
        int ndtfast ;
                ndtfast:long_name = "number of short time-steps" ;
        int nhis ;
                nhis:long_name = "number of time-steps between
history records" ;
        int nrst ;
                nrst:long_name = "number of time-steps between
restart records" ;
                nrst:cycle = "only latest two records are
maintained" ;
        int nsta ;
                nsta:long_name = "number of time-steps between
stations records" ;
        int ntimes ;
                ntimes:long_name = "number of long time-steps" ;
        int ntsavg ;
                ntsavg:long_name = "starting time-step for
accumulation of time-averaged fields" ;
        double ocean_time(ocean_time) ;
                ocean_time:long_name = "averaged" ;
                ocean_time:units = "seconds since 1968-05-23
00:00:00 UTC" ;
                ocean_time:calendar = "365.25 days in every year" ;
                ocean_time:field = "time, scalar, series" ;
                ocean_time:axis = "T" ;
        double pm(eta_rho, xi_rho) ;
                pm:long_name = "curvilinear coordinate metric in XI"
;
                pm:units = "meter-1" ;
                pm:field = "pm, scalar" ;
        double pn(eta_rho, xi_rho) ;
                pn:long_name = "curvilinear coordinate metric in
ETA" ;
                pn:units = "meter-1" ;
                pn:field = "pn, scalar" ;
        double rdrg ;
                rdrg:long_name = "linear drag coefficient" ;
                rdrg:units = "meter second-1" ;
        double rdrg2 ;
                rdrg2:long_name = "quadratic drag coefficient" ;
                rdrg2:units = "nondimensional" ;
        double rho0 ;
                rho0:long_name = "mean density used in Boussinesq
approximation" ;
                rho0:units = "kilogram meter-3" ;
        double s_rho(s_rho) ;
                s_rho:long_name = "S-coordinate at RHO-points" ;
                s_rho:units = "nondimensional" ;
                s_rho:valid_min = -1. ;
                s_rho:valid_max = 0. ;
                s_rho:field = "sc_r, scalar" ;
                s_rho:standard_name = "ocean_s_coordinate" ;
                s_rho:positive = "up" ;
                s_rho:formula_terms = "s: s_rho eta: zeta depth: h
a: theta_s b: theta_b depth_c: hc" ;
        double sc_w(s_w) ;
                sc_w:long_name = "S-coordinate at W-points" ;
                sc_w:units = "nondimensional" ;
                sc_w:valid_min = -1. ;
                sc_w:valid_max = 0. ;
                sc_w:field = "sc_w, scalar" ;
        float sensible(ocean_time, eta_rho, xi_rho) ;
                sensible:units = "Watts meter-2" ;
                sensible:negative = "upward flux, cooling" ;
                sensible:positive = "downward flux, heating" ;
                sensible:time = "ocean_time" ;
                sensible:field = "sensible heat flux, scalar,
series" ;
        float shflux(ocean_time, eta_rho, xi_rho) ;
                shflux:units = "Watts meter-2" ;
                shflux:negative = "upward flux, cooling" ;
                shflux:positive = "downward flux, heating" ;
                shflux:time = "ocean_time" ;
                shflux:field = "surface heat flux, scalar, series" ;
        char spherical ;
                spherical:long_name = "grid type logical switch" ;
                spherical:option_T = "spherical" ;
                spherical:option_F = "Cartesian" ;
        float sustr(ocean_time, eta_u, xi_u) ;
                sustr:units = "Newton meter-2" ;
                sustr:time = "ocean_time" ;
                sustr:field = "surface u-momentum stress, scalar,
series" ;
        float svstr(ocean_time, eta_v, xi_v) ;
                svstr:units = "Newton meter-2" ;
                svstr:time = "ocean_time" ;
                svstr:field = "surface v-momentum stress, scalar,
series" ;
        float swrad(ocean_time, eta_rho, xi_rho) ;
                swrad:units = "Watts meter-2" ;
                swrad:negative = "upward flux, cooling" ;
                swrad:positive = "downward flux, heating" ;
                swrad:time = "ocean_time" ;
                swrad:field = "shortwave radiation, scalar, series"
;
        double theta_b ;
                theta_b:long_name = "S-coordinate bottom control
parameter" ;
                theta_b:units = "nondimensional" ;
        double theta_s ;
                theta_s:long_name = "S-coordinate surface control
parameter" ;
                theta_s:units = "nondimensional" ;
        double tnu2(tracer) ;
                tnu2:long_name = "Laplacian mixing coefficient for
tracers" ;
                tnu2:units = "meter2 second-1" ;
        float ubar(ocean_time, eta_u, xi_u) ;
                ubar:units = "meter second-1" ;
                ubar:time = "ocean_time" ;
                ubar:field = "ubar-velocity, scalar, series" ;
                ubar:coordinates = "lat_u lon_u" ;
        float vbar(ocean_time, eta_v, xi_v) ;
                vbar:units = "meter second-1" ;
                vbar:time = "ocean_time" ;
                vbar:field = "vbar-velocity, scalar, series" ;
                vbar:coordinates = "lat_v lon_v" ;
        double xl ;
                xl:long_name = "domain length in the XI-direction" ;
                xl:units = "meter" ;
        float zeta(ocean_time, eta_rho, xi_rho) ;
                zeta:units = "meter" ;
                zeta:time = "ocean_time" ;
                zeta:field = "free-surface, scalar, series" ;
                zeta:coordinates = "lat_rho lon_rho" ;

// global attributes:
                :type = "ROMS/TOMS averages file" ;
                :title = "ROMS/TOMS 2.0 - Adriatic Sea low-res test
grid K-Omega run" ;
                :var_info = "varinfo.dat" ;
                :rst_file = "river48_new/adria03_rst.nc" ;
                :avg_file = "river48_new/adria03_avg.nc" ;
                :sta_file = "river48_new/adria03_sta.nc" ;
                :flt_file = "river48_new/adria03_flt.nc" ;
                :grd_file = "adria02_grid2.nc" ;
                :ini_file = "adria02_init2.nc" ;
                :frc_file_01 =
"/bag_data3/adriatic/coarse_input/lami_wind_frc.nc" ;
                :frc_file_02 =
"/bag_data3/adriatic/coarse_input/lami_bulk_frc.nc" ;
                :frc_file_03 =
"/bag_data3/adriatic/coarse_input/lami_cloud_frc.nc" ;
                :frc_file_04 =
"/bag_data3/adriatic/coarse_input/lami_swrad_frc.nc" ;
                :frc_file_05 =
"/bag_data3/adriatic/coarse_input/tidal_frc.nc" ;
                :frc_file_06 =
"/bag_data3/adriatic/coarse_input/adria48_rivers.nc" ;
                :fpos_file = "adria02_floats.in" ;
                :spos_file = "adria02_sta.in" ;
                :history = "Fri Oct 8 05:20:59 2004: ncap -s
u=pack(u);v=pack(v);salt=pack(salt);temp=pack(temp)
feb2003_short.nc new.nc\n",
    "Fri Oct 8 04:45:33 2004: ncks -x -v AKs,AKt,AKv
feb2003_cf.nc new.nc\n",
    "Mon Oct 4 21:03:14 2004: ncks -A feb2003b.nc
feb2003b.nc_CF.nc\n",
    "Thu Sep 23 09:23:39 2004: ncra -F -d
ocean_time,140,168 adria03_avg.nc feb2003.nc\n",
    "ROMS/TOMS, Version" ;
                :tiling = "002x001" ;
                :CPP_options = " ANA_BSFLUX, ANA_BTFLUX, ANA_FSOBC,
ANA_M2OBC, ANA_RAIN, ANA_SSFLUX, ASSUMED_SHAPE,
AVERAGES, AVERAGES_AKS, AVERAGES_AKT, AVERAGES_AKV,
AVERAGES_FLUXES, BULK_FLUXES, DIURNAL_SRFLUX,
DJ_GRADPS, DOUBLE_PRECISION, EAST_FSCHAPMAN,
EAST_M2FLATHER, EAST_M3RADIATION, EAST_TRADIATION,
FLOATS, KANTHA_CLAYSON, LONGWAVE, MASKING, MIX_GEO_TS,
MY25_MIXING, NONLIN_EOS, NORTHERN_WALL, N2S2_HORAVG,
_OPENMP, POWER_LAW, PROFILE, K_GSCHEME, RADIATION_2D,
!RST_SINGLE, SALINITY, SOLVE3D, SOUTHERN_WALL,
SPLINES, SSH_TIDES, STATIONS, TS_A4HADVECTION,
TS_A4VADVECTION, TS_DIF2, TS_PSOURCE, UV_ADV, UV_COR,
UV_U3HADVECTION, UV_PSOURCE, UV_TIDES, VAR_RHO_2D,
WESTERN_WALL," ;
                :Conventions = "CF-1.0" ;
                :gridid = "Adria 01" ;
                :CPP-options = "DCOMPLEX, DBLEPREC, NCARG_32,
PLOTS," ;
}


=====
Rich Signell
work: rsignell at usgs.gov
home: rsignell at umich.edu

**************************************************************************** <
Unidata User Support UCAR Unidata Program <
(303)497-8643 P.O. Box 3000 <
support at unidata.ucar.edu Boulder, CO 80307 <
---------------------------------------------------------------------------- <
Unidata WWW Service http://my.unidata.ucar.edu/content/support <
---------------------------------------------------------------------------- <
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publicly available
through the web. If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.
Received on Sat Oct 09 2004 - 09:05:06 BST

This archive was generated by hypermail 2.3.0 : Tue Sep 13 2022 - 23:02:40 BST

⇐ ⇒