[ncl-talk] ESMF_regrid_gen_weights error

Vollaro, David dvollaro at albany.edu
Sun Oct 4 10:47:20 MDT 2020


Hi,

I am trying to read in a grib2 datafile and convert it to a KML file.  I am following  the rastertimeseries2kml
script from the NCL_GETools API page (https://www.ncl.ucar.edu/Document/Manuals/GETools/NCL_GETools.html)

Here is the Logfile PET0.RegridWeightGen.Log contents:
20201004 163128.461 INFO             PET0 Running with ESMF Version 7.0.2
20201004 163128.505 INFO             PET0 Running with ESMF Version 7.0.2
20201004 163128.559 INFO             PET0 Running with ESMF Version 7.0.2
20201004 163130.167 ERROR            PET0 /d1/haley/src/esmf-7.0.2/src/Infrastructure/IO/interface/ESMC
_IOScrip2ESMF.C:48 handle_error Internal error: Bad condition  - line 240: NetCDF error: No such file o
r directory
20201004 163130.167 ERROR            PET0 ESMF_IOScrip.F90:764 ESMF_OutputScripWeightFile Invalid objec
t  - Internal subroutine call returned Error
20201004 163130.167 ERROR            PET0 ESMF_RegridWeightGen.F90:1580 ESMF_RegridWeightGenFile Invali
d object  - Internal subroutine call returned Error

It generates tmpDstGrid.nc, and tmpSrcGrid.nc.  I believe the errors arise when trying to generate a weight file.
 Here is a snippet of my code.  The data is on a 3500x7000 grid at 0.1deg.
         La1 :  54.995
         Lo1 :  230.005
         La2 :  20.005
         Lo2 :  299.995
         Di :   0.009999999
         Dj :   0.01
Lat is in degrees_north Lon in degrees_east. I am running NCL 6.5.0

Below is a snippet of my code.  Thanks

Dave
============================

load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/NCL_GETools.ncl"

begin
;***********************************************
; get variable names from grib file
;***********************************************
   ifile = "/jm13/djv/howie/MRMS_MESH_Max_1440min_00.50_20200811-060832"
   ifile_subs = str_split(ifile,"_")
   nch=strlen(ifile)
   hhmmss = str_get_cols(ifile,nch-6,nch)
   time   = str_get_cols(hhmmss,0,1)+":"+str_get_cols(hhmmss,2,3)+":"+str_get_cols(hhmmss,4,5)
   date =   str_get_cols(ifile,nch-15,nch-12)+"-"+str_get_cols(ifile,nch-11,nch-10)+"-"+str_get_cols(ifile,nch-9,nch-8)
   TimeTag=date+"T"+time
   kml_out = "/jm13/djv/Hailmax_MRMS_"+date+"_"+hhmmss
   grib_in  = addfile(ifile+".grib2","r")
   names    = getfilevarnames(grib_in); extract all variable names
   print(names+" "+TimeTag)

;***********************************************
; loop through variables
;***********************************************
   do i = 0,dimsizes(names)-1
    print(i+" vv "+names(i))
    if (names(i).eq."lat_0") then
      Lat = grib_in->$names(i)$
      print(names(i)+" "+dimsizes(Lat))
    else if (names(i).eq."lon_0") then
      Lon = grib_in->$names(i)$
      print(names(i)+" "+dimsizes(Lon))
    else
      tmp = grib_in->$names(i)$
      print(names(i)+" "+dimsizes(tmp))
      dims=dimsizes(tmp)
      print("LL "+dims(0)+" "+dims(1))
    end if
    end if
   end do
; Create 3D grid transposing from LAT/LON to Lon/Lat
   HailSize=new((/1,dims(1),dims(0)/),"float")
   HailSize=0.
   HailSize(0,:,:) = transpose(tmp)
 ; Create 5 patches of datavalues
   iloc=new((/5/),"integer")
   jloc=new((/5/),"integer")
   ii=0
   do i = 45,25,5
    iloc(ii)=ind_nearest_coord(i,Lat,0)
    print(i+" "+iloc(ii)+" "+Lat(iloc(ii)))
    ii=ii+1
   end do
   ii=0
   do i = 240,280,10
    jloc(ii)=ind_nearest_coord(i,Lon,0)
    print(i+" "+jloc(ii)+" "+Lon(jloc(ii)))
    ii=ii+1
   end do
   do i=0,2
    print(iloc(i)+" "+jloc(i))
    HailSize(0,jloc(i)-5:jloc(i)+5,iloc(i)-5:iloc(i)+5)=3.5
    HailSize(0,jloc(i)-15:jloc(i)+15,iloc(i)-15:iloc(i)+15)=2.5
    HailSize(0,jloc(i)-25:jloc(i)+25,iloc(i)-25:iloc(i)+25)=1.0
   end do
   do i=3,4
    HailSize(0,jloc(i)-15:jloc(i)+15,iloc(i)-15:iloc(i)+15)=1.5
    HailSize(0,jloc(i)-25:jloc(i)+25,iloc(i)-25:iloc(i)+25)=0.5
   end do
   print(Lat(iloc))
   print(Lon(jloc))

; Generate 2D latlon grids from 1D
   Lat2D = new((/dims(1),dims(0)/),"float")
   Lon2D = new((/dims(1),dims(0)/),"float")
   do i=0,dims(0)-1
    Lat2D(:,i)=Lat(i)
   end do
   do j=0,dims(1)-1
    Lon2D(j,:)=Lon(j)
   end do
;Generate contour increments
   cint=fspan(0,5,11)
   print(cint)

; rastertimeseries2kml  template
parm=True
parm at Verbose=True
parm at ColorMap="WhiteBlueGreenYellowRed"
parm at DataSetTitle="MMRS Hail Product"
parm at MinData=0.0
parm at MaxData=5.0
parm at MinDataOpacity=0
parm at MaxDataOpacity=60
parm at IncludeGrid=True
parm at LineWidth=3
parm at Name="MMRS HailSize Algorithm for "+TimeTag
; The following command will create a KML file, called olr12.kml,
; in the current directory, since the first argument, i.e.
; the PATH, is set to "."

; File is very large  extract out subset for debugging
i1=1400
i2=1600
j1=2900
j2=3100
   HailSize1=new((/1,j2-j1+1,i2-i1+1/),"float")
   Lat2D1 = new((/j2-j1+1,i2-i1+1/),"float")
   Lon2D1 = new((/j2-j1+1,i2-i1+1/),"float")
   HailSize1=0.
   HailSize1(0,:,:)=HailSize(0,j1:j2,i1:i2)
   Lat2D1 = Lat2D(j1:j2,i1:i2)
   Lon2D1 = Lon2D(j1:j2,i1:i2)
;HailSize1 at lat2d = Lat2D1
RasterTimeSeries2KML(kml_out,HailSize1,Lon2D1,Lat2D1,TimeTag,parm)

end
=================================================================

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201004/9f8122d0/attachment.html>


More information about the ncl-talk mailing list