[ncl-talk] Sub: ESMF_regridding...

Mary Haley haley at ucar.edu
Thu Feb 4 16:05:47 MST 2016


I don't know if this has anything to do with it, but you don't want a
"return" statement in your main code.  Try removing it.

If you continue to have problems, then you can try this as a debugging
trick:

   - Comment the "begin" and "end" statements
   - Run the script with "ncl -x" and watch as every line gets executed.
   - If stops again, look at which line it is stopping on, and report that
   information back to ncl-talk.

--Mary


On Thu, Feb 4, 2016 at 2:15 PM, Adv <advita6 at gmail.com> wrote:

> Hi,
>
> I have been trying to use ESMF_regridding method to regrid station data
> sets.
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
> begin
> ;a = (/1,2,3,4,5,6,7,8/)
> ;a0 = onedtond(a,(/4,2/))
> ;print(a0)
> ;printVarSummary(a0)
> ;return
> strll  = asciiread("stationmac.txt", -1, "string") ;
>   print(strll)   ; STATION","STATION_NAME", "LAT", "LON"
>   print("=====")
>
> sloc = str_get_field(strll , 2, ",")
>   lat  = tofloat( str_get_field(strll , 3, ",")  )
>   lon  = tofloat( str_get_field(strll , 4, ",")  )
>   print(sloc +" : "+lat+" "+lon)
> print(lon)
> ;&&&&&&&&&&&
> lonm=lon(0:389)
> latm=lat(0:389)
> ;****************
> mlon = 390
> dlon = -90.35 / mlon
> lonn  = fspan (-116.1, (mlon - 1) * dlon, mlon)
> mlat = 390
> dlat = 49.0 / mlat
> latt  = fspan (40.00, (mlat - 1) * dlat, mlat)
> print(lonn)
> minlat=min(latt)
> minlon=min(lonn)
> maxlat=max(latt)
> z1 = asciiread(diri+"prec_avg_Jan-Dec1965-2005",-1,"float")
> print(z1)
> printVarSummary(z1)
> z0 = onedtond(z1,(/390,390/))
> print(z0)
> printVarSummary(z0)
> z0!0="lat"
> z0!1="lon"
> z0&lat=latm
> z0&lon=lonm
> printVarSummary(z0)
> ;print(z0)
> print(min(z0)-min(z1))
> print(max(z0)-max(z1))
> ;ESMF REGRID *******************
> ;---Set up options for regridding to 0.1 degree grid
>   Opt                 = True
>
>   Opt at SrcGridLat      = latm
>   Opt at SrcGridLon      = lonm
> ;---If you don't set these two, the regridding will be VERY slow
>   Opt at DstLLCorner     = (/floor(minlat)-0.1,floor(minlon)+0.1/)
>   Opt at DstURCorner     = (/ ceil(maxlat)-0.1, ceil(maxlon)+0.1/)
>   Opt at DstGridType     = "0.1deg"                ; destination grid
>   Opt at ForceOverwrite  = True
>   Opt at SrcGridMask    = where(.not.ismissing(z0),1,0)
>  Opt at Debug           = True
>   Opt at InterpMethod    = "patch"
>   pwv_regrid_p = ESMF_regrid(z0,Opt)
>   printVarSummary(pwv_regrid_p)
> return
> end
>
> Output printed on the terminal:
> (0)    get_src_grid_info: source lat dims = (390)
> (0)    get_src_grid_info: source lon dims = (390)
> (0)    get_src_grid_info: source grid type is 'rectilinear'
> (0)    curvilinear_to_SCRIP: calculating grid corners...
> (0)    curvilinear_to_SCRIP: no lat values are at the poles, so
> (0)           calculating grid corners using
> (0)           calc_SCRIP_corners_noboundaries...
> (0)    calc_SCRIP_corners_noboundaries
> (0)         min/max original lat: 40.0097/49
> (0)         min/max original lon: -116/-90.35
> (0)    calc_SCRIP_corners_noboundaries
> (0)         min/max Extlat2d: 40.0097/49
> (0)         min/max Extlon2d: -116/-90.35
> (0)    calc_SCRIP_corners_noboundaries
> (0)         min/max ExtGridCenter_lat: 40.0612/48.989
> (0)         min/max ExtGridCenter_lon: -114.417/-91.4917
> (0)    curvilinear_to_SCRIP: calculating grid corners...
> (0)    curvilinear_to_SCRIP: no lat values are at the poles, so
> (0)           calculating grid corners using
> (0)           calc_SCRIP_corners_noboundaries...
> (0)    calc_SCRIP_corners_noboundaries
> (0)         min/max original lat: 39.9/48.9
> (0)         min/max original lon: -116.9/-89.9
> (0)    calc_SCRIP_corners_noboundaries
> (0)         min/max Extlat2d: 39.8/49
> (0)         min/max Extlon2d: -117/-89.8
> (0)    calc_SCRIP_corners_noboundaries
> (0)         min/max ExtGridCenter_lat: 39.85/48.95
> (0)         min/max ExtGridCenter_lon: -116.95/-89.85
> (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 --source source_grid_file.nc --destination
> destination_grid_file.nc --weight weights_file.nc --method patch -i'
> (0)    --------------------------------------------------
>
> After this it just stopped. I couldn't see any output corresponds to the
> command (printVarSummary)
>
> I would appreciate any suggestions to get rid of this bug.
>
> Thank you,
> Adv
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160204/22e8d052/attachment.html 


More information about the ncl-talk mailing list