[ncl-talk] regrid data from one unstructured grid to another unstructured grid

Ming Chen chenming at ucar.edu
Thu Sep 3 12:33:29 MDT 2020


Dear NCL-experts,

I am trying to remap data between different unstructured grids, 
specifically, from MPAS mesh corners to MPAS cell centers. However, the 
following error message appears:

(0)     ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was successful.
(0)     ESMF_regrid_with_weights: regridding using interpolation weights ...
(0)     ESMF_regrid_with_weights: error: there are no weights on this file.
(0)         This likely means there was a problem with the mapping
(0)         from the source grid to the destination grid.
(0)         Check that both grids are valid.

Any help will be appreciated!


Below is the script:

begin
     srcFile = 
"/glade/scratch/chenming/mmm_20200616/MPAS_10km/2017022200/history.2017-02-23_00.00.00.nc"
     dataFile = 
"/glade/scratch/chenming/mmm_20200616/MPAS_10km/2017022200/diag.2017-02-23_00.00.00.nc"

     sfile1 = addfile(srcFile,"r")            ; Source grid
     sfile2 = addfile(dataFile,"r")           ; Source data file

     r2d     = 180.0/(atan(1)*4.0)

     lonVertex = sfile1->lonVertex
     latVertex = sfile1->latVertex
     lonVertex = lonVertex*r2d
     latVertex = latVertex*r2d

     latCell = sfile1->lonCell(:)
     lonCell = sfile1->latCell(:)
     lonCell = lonCell*r2d
     latCell = latCell*r2d

     sp    = ndtooned(sfile2->vorticity_500hPa(0,:))
     sp = sp*10.^5

     Opt                   = True
     Opt at SrcFileName       = "MPAS_ESMF.nc"
     Opt at WgtFileName       = "vertex_2_cell.nc"
     Opt at DstFileName       = "MPAS_CELL.nc"
     Opt at ForceOverwrite    = True
     Opt at SrcGridLat        = latVertex
     Opt at SrcGridLon        = lonVertex
     Opt at SrcInputFileName  = srcFile
     Opt at DstGridLat        = latCell
     Opt at DstGridLon        = lonCell
     Opt at DstTitle          = "MPAS-Vertex2Cell"
     Opt at DstGridType       = "unstructured"
     Opt at SrcGridType       = "unstructured"
     Opt at InterpMethod      = "patch"
     Opt at Debug           = True

     sp_regrid = ESMF_regrid(sp,Opt)

    printVarSummary(sp_regrid)

end



More information about the ncl-talk mailing list