The 2nd error at line 44 .... You have and 'end'
statement but no corresponding 'begin' statement
[1] remove the end statement
or
[2] add a 'begin statement
===============
When I run you script it works.
****Are you running an opendap enabled version of NCL???***
I also added,
printVarSummary(TEMP2M)
(0) OPeNDAP isfilepresent test successful.
Variable: TEMP2M
Type: float
Total Size: 244 bytes
61 values
Number of Dimensions: 1
Dimensions and sizes: [time | 61]
Coordinates:
time: [734399..734406.5]
Number Of Attributes: 5
lon : 9
lat : 45
_FillValue : 9.999e+20
missing_value : 9.999e+20
long_name : ** 2 m above ground temp. [k]
On 09/18/2011 01:46 AM, ugo merlini wrote:
> Hi,
>
> from today I get this error
>
> fatal:Variable (filename) is undefined
> fatal:Execute: Error occurred at or near line 44 in file new_txt.ncl
>
>
> why?
>
> ;----------------------------------------------------------------------
> ; This example shows how to read geographic data
> ; from Natural Earth shapefiles
> ; and plot them as polylines and polygons.
> ;----------------------------------------------------------------------
> ; This particular example plots data for Switzerland.
> ;----------------------------------------------------------------------
> ; Download the shapefiles from http://www.naturalearthdata.com/
> ; Unzip to a directory
> ;----------------------------------------------------------------------
>
> 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/shea_util.ncl"
>
> begin
>
>
> ;******************
> ; read gfs data *
> ;******************
>
> url = "http://nomad1.ncep.noaa.gov:9090/dods/gfs_master/gfs" +
> systemfunc("date +%Y%m%d") + "/"
> systemdate = systemfunc("date +%H")
>
> if ((systemdate.ge.06).and.(systemdate.lt.12)) then
> filename = url + "gfs_master_00z"
> end if
> if ((systemdate.ge.12).and.(systemdate.lt.18)) then
> filename = url + "gfs_master_00z"
> end if
> if ((systemdate.ge.18).and.(systemdate.lt.24)) then
> filename = url + "gfs_master_00z"
> end if
> if ((systemdate.ge.24).and.(systemdate.lt.06)) then
> filename = url + "gfs_master_18z"
> end if
> exists = isfilepresent(filename)
> if(.not.exists) then
> print("OPeNDAP isfilepresent test unsuccessful.")
> print("Either file doesn't exist, or NCL does not have OPeNDAP
> capabilities on this system")
> else
> print("OPeNDAP isfilepresent test successful.")
> gfs = addfile(filename,"r")
> vars = getfilevarnames(gfs)
> end if
>
>
>
>
> ;---data for 2 metres temperature plot
>
> TEMP2M = gfs->tmp2m(:,45,9) ; temperature
> NTIMES = dimsizes(gfs->time) ; number of times in the file
> TEMP2M = TEMP2M - 273.15
> TEMP2M@units = "(C)"
> t=new((/NTIMES,2/), string)
> s=new((/1,NTIMES/), string)
> do it1 = 0,NTIMES-1
> t(it1,0)= it1
> print(t(it1,0))
> ;print(TEMP2M)
> t(it1,1) = (gfs->tmp2m(it1,{45},{9})) - 273.15
> print(t(it1,1))
> s(0,it1) = t(it1,0)+" "+t(it1,1)
> print(gfs->tmp2m(it1,{45},{9}))
> end do
> s=(/ s(0,ispan(0,NTIMES-1,1)) /)
> asciiwrite("prova.txt", s)
> end
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- ====================================================== Dennis J. Shea tel: 303-497-1361 | P.O. Box 3000 fax: 303-497-1333 | Climate Analysis Section | Climate & Global Dynamics Div. | National Center for Atmospheric Research | Boulder, CO 80307 | USA email: shea 'at' ucar.edu | ====================================================== _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Sun Sep 18 18:16:28 2011
This archive was generated by hypermail 2.1.8 : Thu Sep 22 2011 - 17:12:44 MDT