<div dir="ltr"><div><div><div><div>HI Mary,<br></div>yes, it is the source file. However, I don´t know how or why it stopped being removed as the regridding was being performed. I am running a script that does a few hundred files in a row and for some reason it just barfed in the middle. So I now manually removed the the <a href="http://source.nc" target="_blank">source.nc</a> file before starting the script and reran it. And it works fine.<br></div><br></div>thank for the quick reply,<br></div>Dave<br><div><div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 5, 2016 at 5:04 PM, David Adams <span dir="ltr"><<a href="mailto:dave.k.adams@gmail.com" target="_blank">dave.k.adams@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi NCLers,<br></div>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<br></div><br><br> Copyright (C) 1995-2015 - All Rights Reserved<br> University Corporation for Atmospheric Research<br> NCAR Command Language Version 6.3.1-03Jul2015_0233<br> The use of this software is governed by a License Agreement.<br> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>(0) get_src_grid_info: source lat dims = (41,73)<br>(0) get_src_grid_info: source lon dims = (41,73)<br>(0) get_src_grid_info: source grid type is 'curvilinear'<br>fatal:Could not create (<a href="http://source_grid_file.nc" target="_blank">source_grid_file.nc</a>)<br>warning:FileSetFileOption: invalid file or format<br>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 1637 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br><br>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3853 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br><br>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 3983 in file $NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl<br><br>fatal:["Execute.c":8575]:Execute: Error occurred at or near line 48 in file test.ncl<br><br>-----------------------------------------------------------------------------------------------------<br></div>Here is the original code<br><br>; May 31, 2016<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"<br><br>begin<br>;---Data file containing source grid<br> src_file = "goes12_4_2012_121_2345_DenseN.nc" ;;2d lat/lon netcdf file<br>;---Data file containing destination grid<br> dst_file = "2011_09_18_2115_ch4subset_Karen.nc" ;; 1d lat/lon netcdf file<br><br> sfile = addfile(src_file,"r")<br> dfile = addfile(dst_file,"r")<br><br>;---Get variable to regrid<br> var = sfile->temperature<br> src_lat = sfile->latitude ;;--- source 2d lat<br> src_lon = sfile->longitude ;;---source 2d lon<br><br> ;---Get new grid variables<br><br> dst_lat= dfile->lat<br> dst_lon= dfile->lon<br><br>;---Set up regridding options<br> Opt = True<br><br>;---"bilinear" is the default. "patch" and "conserve" are other options.<br> Opt@InterpMethod = "bilinear" ;;---Change (maybe)<br><br> Opt@SrcGridLat = src_lat ; source grid<br> Opt@SrcGridLon = src_lon<br><br> Opt@DstGridLat = dst_lat ; source grid<br> Opt@DstGridLon = dst_lon<br><br> Opt@SrcRegional = False ;;--Change (maybe)<br> Opt@SrcInputFileName = src_file ; optional, but good idea<br> Opt@SrcMask2D = where(.not.ismissing(var),1,0) ; Necessary if has<br> ; missing values.<br> Opt@DstGridType = "rectilinear" ; Destination grid<br> Opt@DstRegional = False ;;--Change (maybe)<br><br> Opt@ForceOverwrite = True<br> Opt@PrintTimings = True<br> Opt@Debug = True<br><br> temp = ESMF_regrid(var,Opt) ; new regridded variable<br><br>;----------------------------------------------------------<br>; write out new netcdf 1d lat/lon files<br>; -------------------------------------------------------------<br> fout = addfile ("<a href="http://goes12_4_2012_121_2345_subset_1d.nc" target="_blank">goes12_4_2012_121_2345_subset_1d.nc</a>", "c")<br>; setfileoption(fout,"DefineMode",True)<br><br> ;===================================================================<br> ; create global attributes of the file<br> ;===================================================================<br> fAtt = True ; assign file attribute<br> fAtt@source_file = "goes12_4_2012_121_2345_DenseN.nc"<br> fAtt@Conventions = "None"<br> fAtt@creation_date = systemfunc ("date")<br> fileattdef(fout,fAtt )<br> temp@_FillValue = -999.99<br> fout->lat = dst_lat ; new 1d lat<br> fout->lon = dst_lon ; new 1d lon<br> fout->temp = temp ; regridded variable<br><br><br></div>thanks in advance,<br></div>Dave<br><div><div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></div></div></div></div>
</blockquote></div><br></div>