Thanks, Dennis, that helped. I'm just trying to read in one file. I am now
running into another issue when running this as a .ncl script, in tcsh
shell. When I run the script listed at the end of this message, I get the
following error:
ls: map_*: No such file or directory
(0) create_rmpPopFileName: file not recognized/found:
map_gx1v3_to_1x1d_bilin_da_010808.nc
(0) create_rmpPopFileName: dir searched: ./
When I try to solve this problem by setting the environment using "setenv
NCL_POP_REMAPV /glade/home/owensh/POP_REMAP" I get the following message,
followed by the previous errors:
fatal:syntax error: line 1 in file regrid2.ncl before or near NCL_POP_REMAPV
setenv NCL_POP_REMAPV
___________
Script:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
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/csm/popRemap.ncl"
;Access file to be regridded
filename = "IFRACyrlyavg.nc"
var1 = "IFRAC"
in = addfile("IFRACyrlyavg.nc","r")
x = in->IFRAC
printVarSummary(x)
;Regrid and save
x_remap = PopLatLon(x,"gx1v3","1x1d","bilin","da","010808")
printVarSummary(x_remap)
diro = "./" ; output directory
filo = filename+"regrid.nc"
system("/bin/rm -f "+diro+filo)
ncdf = addfile(diro_filo, "c")
ncdf->$var1$ = x_remap
> 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 Fri Feb 24 14:40:55 2012
This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST