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

Dennis Shea shea at ucar.edu
Fri Sep 4 15:00:49 MDT 2020


Hello,

I see nothing wrong with your script.
The ESMF package invoked by NCL has had some issues with unstructured
grids.
For "fun" I switched the method from "patch" to "bilibear".
The same error was encountered.

I will look a bit more bur ... likely after Labor Day.

Regards
D
[bilinear]

%> ncl MingChen.ncl

 Copyright (C) 1995-2019 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.6.2
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
(0) get_src_grid_info: source lat dims = (501576)
(0) get_src_grid_info: source lon dims = (501576)
(0) get_src_grid_info: source grid type is 'unstructured'
(0) unstructured_to_ESMF: triangulating the data to create the edges for
your unstructured data.
(0)                      This can be VERY slow if you have a large array.
(0)                      To speed up code, provide your own edge vertices
via the
(0)                      'ElementVertices' option.
(0) min/max ElementVertices = 0/501575
(0) unstructured_to_ESMF: total number of elements created: 1003004
(0) unstructured_to_ESMF: Element Area: min:8.240130582062269e-11
max:0.000118294428582022
(0) write_grid_description_file: writing unstructured 'Src' grid to an ESMF
description file
(0) get_dst_grid_info: destination lat dims = (250364)
(0) get_dst_grid_info: destination lon dims = (250364)
(0) unstructured_to_ESMF: triangulating the data to create the edges for
your unstructured data.
(0)                      This can be VERY slow if you have a large array.
(0)                      To speed up code, provide your own edge vertices
via the
(0)                      'ElementVertices' option.
(0) min/max ElementVertices = 0/250363
(0) unstructured_to_ESMF: total number of elements created: 500658
(0) unstructured_to_ESMF: Element Area: min:1.381117442633695e-13
max:0.008010342243264967
(0) write_grid_description_file: writing unstructured 'Dst' grid to an ESMF
description file
(0) ESMF_regrid_gen_weights: number of processors used: 1
(0) --------------------------------------------------
(0) ESMF_regrid_gen_weights: the following command is about to be executed
on the system:
(0) 'ESMF_RegridWeightGen --ignore_degenerate --src_loc corner --dst_loc
corner  --source MPAS_ESMF.nc --destination MPAS_CELL.nc --weight
vertex_2_cell.nc --method bilinear --src_type ESMF --dst_type ESMF -i'
(0) --------------------------------------------------
(0) ESMF_regrid_gen_weights: output from 'ESMF_RegridWeightGen':
(0)
(1)      WARNING: deprecated switch -src_type will be ignored.  The file
type will be de
(2)      tected automatically
(3)
(4)      WARNING: deprecated switch -dst_type will be ignored.  The file
type will be de
(5)      tected automatically
(6)      Starting weight generation with these inputs:
(7)        Source File: MPAS_ESMF.nc
(8)        Destination File: MPAS_CELL.nc
(9)        Weight File: vertex_2_cell.nc
(10)        Source File is in ESMF format
(11)        Source Grid is a global grid
(12)        Source Grid is an unstructured grid
(13)        Use the corner coordinates of the source grid to do the regrid
(14)        Destination File is in ESMF format
(15)        Destination Grid is a global grid
(16)        Destination Grid is an unstructured grid
(17)        Use the corner coordinates of the destination grid to do the
regrid
(18)        Regrid Method: bilinear
(19)        Pole option: ALL
(20)        Ignore unmapped destination points
(21)        Ignore degenerate cells in the input grids
(22)        Line Type: cartesian
(23)        Norm Type: dstarea
(24)        Extrap. Method: none
(25)
(26)      Completed weight generation successfully.
(27)
(0) --------------------------------------------------
(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.
Variable: sp_regrid
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
Number Of Attributes: 3
  _FillValue : 9.96921e+36
  lat1d : <ARRAY of 250364 elements>
  lon1d : <ARRAY of 250364 elements>

===========
Variable: sp_regrid
Type: float
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
Number Of Attributes: 3
  _FillValue : 9.96921e+36
  lat1d : <ARRAY of 250364 elements>
  lon1d : <ARRAY of 250364 elements>

========================



On Thu, Sep 3, 2020 at 12:33 PM Ming Chen via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> 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
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200904/b3f75485/attachment.html>


More information about the ncl-talk mailing list