[ncl-talk] Issue regridding with ESMF from unstructured

Anil Kumar - NOAA Affiliate anil.kumar at noaa.gov
Fri Jun 29 11:14:49 MDT 2018


Andrew,
I did similar thing to regrid unstructed data on to wrf grid (geo_em_d01.nc)
here is the code and worked successfully with ncl 6.4 version.
Hope this help.

src_file = "maxele.63.nc"

 sfile = addfile(src_file,"r")


;printVarSummary(sfile)

 lat1D = sfile->y

 lon1D = sfile->x

 var = sfile->zeta_max(0,:)   ; zeta is function of time and variable.


 dst_file = "geo_em.d01.nc"

 dfile    = addfile(dst_file,"r")



;---Set up regridding options


    Opt                = True


;---"bilinear" is the default. "patch" and "conserve" are other options.

    Opt at InterpMethod     = "neareststod"        ;;---Change (maybe)

    Opt at WgtFileName      = "unstruct_to_rect.nc"


    Opt at SrcGridLat       = lat1D

    Opt at SrcGridLon       = lon1D

    Opt at SrcRegional      = False            ;;--Change (maybe)

    Opt at SrcInputFileName = src_file          ; optional, but good idea


    Opt at SrcMask2D        = where(.not.ismissing(var),1,0) ; Necessary if has

                                                          ; missing values.


    dst_lat              = dfile->XLAT_M(0,:,:)    ; Be sure to use
appropriate names

    dst_lon              = dfile->XLONG_M(0,:,:)   ; here.

    Opt at DstGridLon       = dst_lon

    Opt at DstGridLat       = dst_lat

    Opt at DstRegional      = True            ;;--Change (maybe)

;    Opt at DstMask2D = where(.not.ismissing(dst_lat).and.\

;                          .not.ismissing(dst_lon),1,0) ; Necessary if
lat/lon

                                                      ; has missing values.

                                                      ; has missing values.

    Opt at ForceOverwrite   = True

    Opt at Debug            = True

    Opt at PrintTimings     = True


    var_regrid = ESMF_regrid(var,Opt)     ; Do the regridding


    printVarSummary(var_regrid)








On Fri, Jun 29, 2018 at 11:56 AM, Andrew Kren - NOAA Affiliate <
andrew.kren at noaa.gov> wrote:

> Dear ncl-talk,
>
> I'm trying to regrid from an unstructured grid of temperature and moisture
> retrievals from an aircraft. The data are a function of (lev,time), with
> each time corresponding to a different lat/lon location. I wrote some code
> to regrid to a triangular mesh using ESMF, but ran into some issues. I got
> this error:
>
> (0) get_src_grid_info: source lat dims = (14398)
>
> (0) get_src_grid_info: source lon dims = (14398)
>
> (0) get_src_grid_info: SrcGridType and/or SrcGridLat/SrcGridLon were not
> set.
>
> (0)           Cannot determine the source grid type.
>
> I have attached my code and a sample file it reads. I am confused b/c I am
> setting the SrcGridLat and Lon explicitly.
>
> Thanks,
>
> --
> Andrew Kren
> Assistant Scientist
> CIMAS - NOAA/AOML
> 314-322-0867
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Dr. Anil Kumar
NWS/NCEP/EMC, Office# 2875
NOAA Center for Weather and Climate Prediction (NCWCP)
5830 UNIVERSITY RESEARCH CT
College Park, MD 20740-3818
301-683-0494
anil.kumar at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180629/e909e17c/attachment.html>


More information about the ncl-talk mailing list