It looks like you are mixing shell scripting (set, #) and NCL.
There is no need for 'begin' and 'end' in an NCL main script.
Are you reading one file or multiple files. I see an *
in your addfile. If multiple files you want 'addfiles'.
Note the 's' at the end.
If you are new to NCL, I suggest you read the
"Mini-Language Manual" at: http://www.ncl.ucar.edu/Document/Manuals/
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/popRemap.ncl"
; Access file to be regridded
runname = "b40.20th.track1.1deg.007"
var1 = "IFRAC"
rundir = runname+"/monthly/"
filnam = systemfunc("cd "+rundir+" ; ls
"+runname+"."+var1+"*_monthlyavg.nc")
print(filnam)
in = addfiles(rundir+filnam,"r")
x = in[:]->$var1$
printVarSummary(x)
#Regrid and save
x_remap = PopLatLon(x,"gx1v3","1x1d","bilin","da","010808")
printVarSummary(x_remap)
diro = "./" ; output directory
filo = var1+"."+runname+".nc"
system("/bin/rm -f "+diro+filo)
ncdf = addfile(diro_filo, "c")
ncdf->$var1$ = x_remap
On 2/22/12 8:23 AM, owensh@ucar.edu wrote:
> Hi,
> I am still pretty new to ncl, and I'm trying to regrid netCDF files from
> POP grid to 1X1 degree. How do I write the output of popLatLon to netCDF?
> Below is as far as I've gotten with the script.
>
> Thank you very much for your help,
> Hannah
>
> #Import necessary stuff
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/popRemap.ncl"
>
> #Access file to be regridded
> set runname = b40.20th.track1.1deg.007
> set var1 = IFRAC
> set rundir = $runname/monthly
>
> begin
> in = addfile("$rundir/$runname.$var1*_monthlyavg.nc","r")
> var1 = in->hi
>
> #Regrid and save
> remap = PopLatLon(ice,"gx1v3","1x1d","bilin","da","010808")
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 22 10:02:25 2012
This archive was generated by hypermail 2.1.8 : Thu Feb 23 2012 - 10:01:53 MST