[ncl-talk] Error Generating Weight Files for ESMF regridding

Glotfelty, Timothy William twglotfe at email.unc.edu
Mon Mar 26 08:18:36 MDT 2018


Hi Mary,

     Thank you for getting back to me. I tried the netcdf4 option but that did not fix the issue. The destination_grid_file.nc is 3.5 MB but the source_grid_file.nc is very large at 4.6 GB.    I’m using NCL version 6.4.0.   My original input files are approximately 1.5 GB in total. Is that too large to upload to the frp site?

Thanks,
Tim

From: Mary Haley [mailto:haley at ucar.edu]
Sent: Friday, March 23, 2018 5:18 PM
To: Glotfelty, Timothy William <twglotfe at email.unc.edu>
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Error Generating Weight Files for ESMF regridding

Hi Tim,

Hmmm, I'm not sure about this, but maybe the weights file is too large?  You might need to set:

    Opt at WgtNetCDFType = "netcdf4"

which will force a NetCDF4 file to be written, which allows for large variables. I'm a little dubious this will fix these, because it should have complained when it tried to write that file.

How big are source_grid_file.nc<http://source_grid_file.nc> and destination_grid_file.nc<http://destination_grid_file.nc>?

Also, what version of NCL are you using?

If you continue to have problems even when setting the WgtNetCDFType option, then could you provide the input files, if they are not excessively large?  You can use our ftp:

http://www.ncl.ucar.edu/ftp_files.shtml

Thanks,

--Mary



On Fri, Mar 23, 2018 at 12:13 PM, Glotfelty, Timothy William <twglotfe at email.unc.edu<mailto:twglotfe at email.unc.edu>> wrote:
Hello,

   I’m trying to run the ESMF regridding function to regrid land use and land cover information from a rectilinear Albers equal area projection to a WRF lambert conformal projection. I’ve used a version of this script many times to regrid between different projections and it has worked perfectly but this time I get an error indicating that the weights cannot be generated. Any ideas as to why this might be occurring? Could it have something to do with the Albers projection?

My script is as follows:

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"

begin
vars = (/"2006_2001_Loss","2006_2001_Gain","2006_2001_Shift"/)
outfile = "MODIS.2006-2001.Africa.nc<http://MODIS.2006-2001.Africa.nc>"
fon = addfile(outfile,"c")

do v=0,dimsizes(vars)-1

;---Data file containing source grid
    src_file = "Change.2001_2006.nc<http://Change.2001_2006.nc>"               ;;---Change (likely)
    src_map  = "MODIS_2001.nc"
    sfile    = addfile(src_file,"r")
    smfile   = addfile(src_map,"r")

;---Get variable to regrid
    var_name = vars(v)           ;;---Change (likely)
    var      = sfile->$var_name$            ;;---Change (likely)
    src_lat  = smfile->latitude                   ;;---Change (maybe)
    src_lon  = smfile->longitude                 ;;---Change (maybe)

;---Data file containing destination grid
    dst_file = "map.Africa.nc<http://map.Africa.nc>"        ;;---Change (likely)
    dfile    = addfile(dst_file,"r")
    dst_lat  = dfile->XLAT(0,:,:)                   ;;---Change (likely)
    dst_lon  = dfile->XLONG(0,:,:)                  ;;---Change (likely)

;---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       = "rec_to_curv.nc<http://rec_to_curv.nc>"  ; optional

    Opt at SrcGridLat        = src_lat           ; source grid
    Opt at SrcGridLon        = src_lon
    Opt at SrcRegional       = True              ;;--Change (maybe)
    Opt at SrcInputFileName  = src_file          ; optional, but good idea
                                                           ; missing values.

    Opt at DstGridLat        = dst_lat             ; destination grid
    Opt at DstGridLon        = dst_lon
    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.

    Opt at ForceOverwrite    = True
    Opt at PrintTimings      = True
    Opt at Debug             = True

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

    fon->$var_name$ = var_regrid

    printVarSummary(var_regrid)
    delete(var_name)
    delete(var)
    delete(var_regrid)
    delete(dst_lat)
    delete(dst_lon)
    delete(src_lat)
    delete(src_lon)
    delete(Opt)
end do
end

The script output with the error message is as follows

(0)     get_src_grid_info: source lat dims = (7770)
(0)     get_src_grid_info: source lon dims = (7563)
(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: -35.23254905085637/37.99549894885637
(0)          min/max original lon: -18.96852865285641/52.3084051828564
(0)     calc_SCRIP_corners_noboundaries
(0)          min/max Extlat2d: -35.24197472314363/38.00492462114362
(0)          min/max Extlon2d: -18.9779543251436/52.3178308551436
(0)     calc_SCRIP_corners_noboundaries
(0)          min/max ExtGridCenter_lat: -35.237261887/38.00021178499999
(0)          min/max ExtGridCenter_lon: -18.973241489/52.313118019
(0)     =====> CPU Elapsed Time: rectilinear_to_SCRIP: 49.0142 seconds <=====
(0)     get_dst_grid_info: destination lat dims = (169,252)
(0)     get_dst_grid_info: destination lon dims = (169,252)
(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: -35.2259/19.128
(0)          min/max original lon: -24.1202/64.4362
(0)     calc_SCRIP_corners_noboundaries
(0)          min/max Extlat2d: -35.5159/19.4431
(0)          min/max Extlon2d: -24.5117/64.8278
(0)     calc_SCRIP_corners_noboundaries
(0)          min/max ExtGridCenter_lat: -35.3709/19.2855
(0)          min/max ExtGridCenter_lon: -24.3161/64.6321
(0)     =====> CPU Elapsed Time: curvilinear_to_SCRIP: 0.0331116 seconds <=====
(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<http://source_grid_file.nc> --destination destination_grid_file.nc<http://destination_grid_file.nc> --weight rec_to_curv.nc<http://rec_to_curv.nc> --method neareststod --src_regional --dst_regional -i'
(0)     --------------------------------------------------
(0)     ESMF_regrid_gen_weights: output from 'ESMF_RegridWeightGen':
(0)           Starting weight generation with these inputs:
(1)             Source File: source_grid_file.nc<http://source_grid_file.nc>
(2)             Destination File: destination_grid_file.nc<http://destination_grid_file.nc>
(3)             Weight File: rec_to_curv.nc<http://rec_to_curv.nc>
(4)             Source File is in SCRIP format
(5)             Source Grid is a regional grid
(6)             Source Grid is a logically rectangular grid
(7)             Destination File is in SCRIP format
(8)             Destination Grid is a regional grid
(9)             Destination Grid is a logically rectangular grid
(10)            Regrid Method: nearest source to destination
(11)            Pole option: NONE
(12)            Ignore unmapped destination points
(13)            Norm Type: dstarea
(14)
(0)     --------------------------------------------------
(0)     ESMF_regrid_gen_weights: 'ESMF_RegridWeightGen' was not successful.

I checked the weights log file and the only information it has is the following

20180323 140041.361 INFO             PET0 Running with ESMF Version 6.3.0rp1
20180323 140041.376 INFO             PET0 Running with ESMF Version 6.3.0rp1
20180323 140041.408 INFO             PET0 Running with ESMF Version 6.3.0rp1

Thanks,
Tim Glotfelty
Postdoctoral Research Associate
Department of Environmental Science and Engineering
University of North Carolina at Chapel Hill

_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto: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/20180326/0ff4d913/attachment.html>


More information about the ncl-talk mailing list