[ncl-talk] ESMF_regridding.ncl error

David Adams dave.k.adams at gmail.com
Sun Jun 5 16:04:43 MDT 2016


Hi NCLers,
I am regridding 2d lat/lon curvilinear grid (GOES IR data)  to a 1d lat/lon
grid.  The program worked fine, I have good results; however, now I am
getting an error when calling the ESMF_regridding.ncl routine.  I don´t
know if I accidentally removed something from the code or corrupted it
somehow.  But here is the error message


 Copyright (C) 1995-2015 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.3.1-03Jul2015_0233
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
(0)    get_src_grid_info: source lat dims = (41,73)
(0)    get_src_grid_info: source lon dims = (41,73)
(0)    get_src_grid_info: source grid type is 'curvilinear'
fatal:Could not create (source_grid_file.nc)
warning:FileSetFileOption: invalid file or format
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 1637 in
file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3853 in
file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3983 in
file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 48 in file
test.ncl

-----------------------------------------------------------------------------------------------------
Here is the original code

;   May 31, 2016
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
;---Data file containing source grid
    src_file = "goes12_4_2012_121_2345_DenseN.nc"        ;;2d lat/lon
netcdf file
;---Data file containing destination grid
    dst_file = "2011_09_18_2115_ch4subset_Karen.nc"   ;; 1d lat/lon netcdf
file

    sfile    = addfile(src_file,"r")
    dfile    = addfile(dst_file,"r")

;---Get variable to regrid
    var     = sfile->temperature
    src_lat = sfile->latitude      ;;--- source 2d lat
    src_lon = sfile->longitude     ;;---source 2d lon

 ;---Get new grid variables

    dst_lat= dfile->lat
    dst_lon= dfile->lon

;---Set up regridding options
    Opt                   = True

;---"bilinear" is the default. "patch" and "conserve" are other options.
    Opt at InterpMethod      = "bilinear"        ;;---Change (maybe)

    Opt at SrcGridLat        = src_lat           ; source grid
    Opt at SrcGridLon        = src_lon

    Opt at DstGridLat        = dst_lat           ; source grid
    Opt at DstGridLon        = dst_lon

    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.
    Opt at DstGridType       = "rectilinear"            ; Destination grid
   Opt at DstRegional       = False                   ;;--Change (maybe)

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

     temp = ESMF_regrid(var,Opt)     ; new regridded variable

;----------------------------------------------------------
;   write out new netcdf 1d lat/lon files
; -------------------------------------------------------------
    fout  = addfile ("goes12_4_2012_121_2345_subset_1d.nc", "c")
;    setfileoption(fout,"DefineMode",True)

 ;===================================================================
    ; create global attributes of the file
    ;===================================================================
        fAtt               = True            ; assign file attribute
        fAtt at source_file   =  "goes12_4_2012_121_2345_DenseN.nc"
        fAtt at Conventions   = "None"
        fAtt at creation_date = systemfunc ("date")
        fileattdef(fout,fAtt )
       temp at _FillValue = -999.99
       fout->lat  = dst_lat           ;  new 1d lat
       fout->lon =  dst_lon           ;  new 1d lon
       fout->temp =  temp             ; regridded variable


thanks in advance,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160605/129d80db/attachment.html 


More information about the ncl-talk mailing list