<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Dear NCL help,
<div class=""><br class="">
</div>
<div class="">I am having trouble regridding my WRF precipitation data (4 km) to a coarser grid (10 km grid with a polar stereographic projection) using the “conserve” method. I should note that it works for the “bilinear method”. I get the following error
when using the “conserve” method. I am using NCL V6.3.</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172919.788 INFO PET0 Running with ESMF Version 6.3.0rp1</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 ~~~~~~~~~~~~~~~~~~~~ Concave Element Detected ~~~~~~~~~~~~~~~~~~~~</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 concave elem. id=683007</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 </div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 concave elem. coords (lon [-180 to 180], lat [-90 to 90]) (x,y,z)</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 -----------------------------------------------------------------</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 0 (-100.720581, 89.804306) (-0.000635, -0.003356, 0.999994)</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 1 (-76.010437, 89.767494) (0.000981, -0.003938, 0.999992)</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 2 (-133.219574, 89.857407) (-0.001704, -0.001814, 0.999997)</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 3 (130.780121, 89.925125) (-0.000854, 0.000990, 0.999999)</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.034 ERROR PET0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.035 ERROR PET0 ESMCI_Regrid_F.C:178 c_esmc_regrid_create() Invalid argument - Dst contains a concave cell</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.035 ERROR PET0 ESMCI_Regrid_F.C:434 c_esmc_regrid_create() Invalid argument Internal subroutine call returned Error</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.035 ERROR PET0 ESMF_Regrid.F90:321 ESMF_RegridStore Invalid argument - Internal subroutine call returned Error</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.035 ERROR PET0 ESMF_FieldRegrid.F90:1008 ESMF_FieldRegridStoreNX Invalid argument - Internal subroutine call returned Error</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class="">20170621 172940.035 ERROR PET0 ESMF_RegridWeightGen.F90:1152 ESMF_RegridWeightGenFile Invalid argument - Internal subroutine call returned Error</div>
<div style="margin: 0px; font-size: 13px; font-family: Menlo;" class=""><br class="">
</div>
</div>
<div class=""><br class="">
</div>
<div class=""> I have searched the archives regarding this error and have changed the longitudes of both the source and destination grids so that it goes from 0-360 instead of -180 to 180 as suggested, but I still get the same error. I have FTP’d the files
in the following script.</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div>
<div class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div>
<div class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div>
<div class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"</div>
<div class=""><br class="">
</div>
<div class="">begin</div>
<div class="">;---Data file containing source grid</div>
<div class=""> src_file = "/home/umalmonj/Jan_Apr_monthly_total_2d.nc" ;;---Change (likely)</div>
<div class=""> src_constants = "/global/scratch/umalmonj/WRF/juris/CTRL/2D/wrfout_conus_constants.nc"</div>
<div class=""> sfile = addfile(src_file,"r")</div>
<div class=""> constants = addfile(src_constants,"r")</div>
<div class=""><br class="">
</div>
<div class="">;---Get variable to regrid</div>
<div class="">prec_acc_nc = sfile->PREC_ACC_NC</div>
<div class="">var = dim_sum_n_Wrap(prec_acc_nc,0) ; this sums the variable for the 4 months</div>
<div class=""> src_lat = constants->XLAT(0,:,:) ;;---Change (maybe)</div>
<div class=""> src_lon = constants->XLONG(0,:,:) ;;---Change (maybe)</div>
<div class=""> var@lat2d = src_lat ;;---Change (likely)</div>
<div class=""> src_lon = where(src_lon.lt.0,src_lon+360,src_lon)</div>
<div class=""> var@lon2d=src_lon</div>
<div class=""><br class="">
</div>
<div class="">;---Data file containing destination grid</div>
<div class=""> dst_file = "/global/scratch/umalmonj/WRF/juris/CaPA/AccumulatedtotalPrecipitation.nc" ;;---Change (likely)</div>
<div class=""> dfile = addfile(dst_file,"r")</div>
<div class=""> dst_lat = dfile->gridlat_0 ;;---Change (likely)</div>
<div class=""> dst_long = dfile->gridlon_0 ;;---Change (likely)</div>
<div class=""> dst_lon = where(dst_long.lt.0,dst_long+360,dst_long)</div>
<div class=""><br class="">
</div>
<div class="">;---Set up regridding options</div>
<div class=""> Opt = True</div>
<div class=""><br class="">
</div>
<div class="">;---"bilinear" is the default. "patch" and "conserve" are other options.</div>
<div class=""> Opt@InterpMethod = "conserve" ; might want to use conservative for precip</div>
<div class=""><br class="">
</div>
<div class=""> Opt@WgtFileName = "curv_to_curv.nc" ; optional</div>
<div class=""><br class="">
</div>
<div class=""> Opt@SrcGridLat = src_lat ; source grid</div>
<div class=""> Opt@SrcGridLon = src_lon</div>
<div class=""> Opt@SrcRegional = True ;;--Change (maybe)</div>
<div class=""> Opt@SrcFileName = src_file ; optional, but good idea</div>
<div class=""> Opt@SrcGridMask = where(.not.ismissing(var),1,0) ; Necessary if has</div>
<div class=""> ; missing values.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""> Opt@DstGridLat = dst_lat ; destination grid</div>
<div class=""> Opt@DstGridLon = dst_lon</div>
<div class=""> Opt@DstRegional = True ;;--Change (maybe)</div>
<div class=""> Opt@DstGridMask = where(.not.ismissing(dst_lat).and.\</div>
<div class=""> .not.ismissing(dst_lon),1,0) ; Necessary if lat/lon</div>
<div class=""> ; has missing values.</div>
<div class="">; there is an attribute in the dest. file called "corners", but there are four</div>
<div class="">; diff. numbers for both the lon and lat variables</div>
<div class="">; just let NCL figure out the corners...</div>
<div class="">; Opt@DstLLCorner = (/12.21208,217.1075/)</div>
<div class="">; Opt@DstURCorner = (/79.82558,147.6248/)</div>
<div class=""> Opt@ForceOverwrite = True</div>
<div class=""> Opt@PrintTimings = True</div>
<div class=""> Opt@Debug = True</div>
<div class=""><br class="">
</div>
<div class=""> var_regrid = ESMF_regrid(var,Opt) ; Do the regridding</div>
<div class=""><br class="">
</div>
<div class=""> printVarSummary(var_regrid)</div>
<div class=""><br class="">
</div>
</div>
<div class=""><br class="">
</div>
<div class="">Any help would be greatly appreciated,</div>
<div class=""><br class="">
</div>
<div class="">Juris</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
</body>
</html>