#828 closed upgrade (Done)

Matlab Scripts to Compute Coupling Melding Coefficents

Reported by: arango Owned by:
Priority: major Milestone: Release ROMS/TOMS 3.8
Component: Matlab Version: 3.8
Keywords: Cc:


  • The Melding coefficients are used to combine fields from DATA and ESM components. The weight factors are read from the input NetCDF specified in the WeightsFile(atmos) keyword of coupling_esmf.in The user has full control of how the merging is done. It is recommended to provide a gradual transition between the two components.

Recall that the DATA component supplies needed data to a particular ESM component. For example, it may export data to the atmosphere model at locations not covered by the other ESM components because of smaller grid coverage. If the atmosphere and ocean model grids are incongruent, the atmosphere component needs to import sea surface temperature (SST) on those grid points not covered by the ocean component. Thus, the weighting coefficients are used to merge the SST data:

        SST_atm(:,:) = Cesm(:,:) * SST_esm(:,:) + Cdat(:,:) * SST_dat(:,:)
        Cesm(:,:) + Cdat(:,:) = 1.

In coupling_esmf.in, we now have:

! Weighted coefficients for the merging of DATA component fields with the same
! field from other ESM components. Melding coefficients are positive and MUST
! add to unity. They are read from an input NetCDF file ('WeightsFile'). The
! user needs to specify the NetCDF variable names for the weights for the DATA
! ('VnameDATA') and ESM ('VnameESM') components. Currently, the weight values
! are only needed by the atmosphere component.

WeightsFile(atmos) == meld_weights_atm.nc
  VnameDATA(atmos) =  data_weight
   VnameESM(atmos) =  ocean_weight

We no longer use the WeightDAT and WeightESM constant parameters from previous versions.

  • Several functions to compute melding weights between DATA and ROMS coupling components for exporting fields to the atmosphere component.
    • c_weithts.m: Creates a new weight factor NetCDF file for melding DATA and OCEAN components during ESMF coupling.
    • coamps_weights.m: Computes and writes the COAMPS melding weights to combine fields from DATA and ROMS components after ESMF regridding to the atmosphere grid.
    • smooth_weights.m: Computes smooth melding weights to combine fields from DATA and OCEAN components. The merging factors change gradually in an area next to the OCEAN grid open boundary.
    • wrf_weights.m: Computes and writes the WRF melding weights to combine fields from DATA and ROMS components after ESMF regridding to the atmosphere grid.

Many thanks to John Wilkin for his help in coding the generic Matlab script smooth_weights.m to compute the varying weight factors at each grid cell of the atmosphere grid.

  • The coamps_weights.m is used to compute the melding weight factors for COAMPS 15km resolution grid that combines SST from the DATA (HyCOM) and ROMS components in the Indian Ocean coupled application.


Here, N=200 is the number of convolutions used to smooth the transition between DATA and ROMS components.

  • The wrf_weights.m is used to compute the melding weight factors for WRF 6km resolution grid that combines SST from the DATA (HyCOM) and ROMS components in a U.S. East Coast application to study Hurricanes Irene and Sandy.


  • The c_weights.m creates a simple NetCDF file containing both the rigid and smooth weights for the DATA and OCEAN components.
    netcdf wrf6km_meld_weights {
            lon = 319 ;
            lat = 279 ;
            double lon(lat, lon) ;
                    lon:long_name = "longitude" ;
                    lon:standard_name = "longitude" ;
                    lon:units = "degrees_east" ;
            double lat(lat, lon) ;
                    lat:long_name = "latitude" ;
                    lat:standard_name = "latitude" ;
                    lat:units = "degrees_north" ;
            double mask(lat, lon) ;
                    mask:long_name = "land-sea mask" ;
                    mask:flag_values = 0., 1. ;
                    mask:flag_meanings = "land sea" ;
                    mask:coordinates = "lon lat" ;
            double data_weight_rigid(lat, lon) ;
                    data_weight_rigid:long_name = "DATA component rigid melding weights" ;
                    data_weight_rigid:valid_min = 0. ;
                    data_weight_rigid:valid_max = 1. ;
                    data_weight_rigid:coordinates = "lon lat" ;
            double ocean_weight_rigid(lat, lon) ;
                    ocean_weight_rigid:long_name = "OCEAN component rigid melding weights" ;
                    ocean_weight_rigid:valid_min = 0. ;
                    ocean_weight_rigid:valid_max = 1. ;
                    ocean_weight_rigid:coordinates = "lon lat" ;
            double data_weight_smooth(lat, lon) ;
                    data_weight_smooth:long_name = "DATA component smooth melding weights" ;
                    data_weight_smooth:valid_min = 0. ;
                    data_weight_smooth:valid_max = 1. ;
                    data_weight_smooth:coordinates = "lon lat" ;
            double ocean_weight_smooth(lat, lon) ;
                    ocean_weight_smooth:long_name = "OCEAN component smooth melding weights" ;
                    ocean_weight_smooth:valid_min = 0. ;
                    ocean_weight_smooth:valid_max = 1. ;
                    ocean_weight_smooth:coordinates = "lon lat" ;
    // global attributes:
                    :Conventions = "CF-1.0" ;
                    :title = "WRF coupling import field melding weights between `DATA and ROMS components" ;
                    :wrf_grid = "/s1/arango/ocean/repository/Projects/irene/Data/WRF/6km/irene_wrf_inp_d01.nc" ;
                    :roms_grid = "/s1/arango/ocean/repository/Projects/om/grid_doppio_JJA_v12n.nc" ;
                    :convolutions = "150" ;
                    :history = "Weights file created using Matlab script /Users/arango/ocean/repository/matlab/coupling/wrf_weights.m 24-Oct-2019 21:39:02" ;
  • Added and updated several Matlab scripts.

Change History (1)

comment:1 Changed 14 months ago by arango

  • Resolution set to Done
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.