[ncl-install] Question

Karin Meier-Fleischer meier-fleischer at dkrz.de
Tue May 12 09:39:02 MDT 2015


Hi Najib,

you have a typo in the second addfile call. See below.


> Am 12.05.2015 um 17:09 schrieb Najib Yusuf <najibgal at yahoo.com>:
> 
> Hello,
> I am a new ncl learner, and i am trying to make a plot from an ascii data file but i am getting error messages, kindly guide me, this is how it looks like;
> 
> najib at UbuntuVaio:~$ ncl
>  Copyright (C) 1995-2012 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.1.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
> ncl 0> dir = "/home/najib/Desktop/"
> ncl 1> filen = "TRODAN.dat"
> ncl 2> z1 = asciiread(dir+filen,(/3326/),"string")
> ncl 3> printVarSummary(z1)
> 

here your file is called  /home/najib/Desktop/TRODAN.dat

> Variable: z1
> Type: string
> Total Size: 26608 bytes
>             3326 values
> Number of Dimensions: 1
> Dimensions and sizes:    [3326]
> Coordinates: 
> Number Of Attributes: 1
>   _FillValue :    missing
> ncl 4> new_str = str_split_csv(z1, ",", 1)
> ncl 5>  printVarSummary(new_str)
> 
> Variable: new_str
> Type: string
> Total Size: 266080 bytes
>             33260 values
> Number of Dimensions: 2
> Dimensions and sizes:    [3326] x [10]
> Coordinates: 
> Number Of Attributes: 1
>   _FillValue :    missing
> ncl 6> _FillValue = 999
> ncl 7> variables = new_str(0,0:9)
> ncl 8> print(variables)
> 
> 
> Variable: variables
> Type: string
> Total Size: 80 bytes
>             10 values
> Number of Dimensions: 1
> Dimensions and sizes:    [10]
> Coordinates: 
> Number Of Attributes: 1
>   _FillValue :    missing
> (0)    Year
> (1)    Month
> (2)    Day
> (3)    Hour
> (4)    Minute
> (5)    Second
> (6)    UT_sec
> (7)    Ozone_ppbv
> (8)    Temperature_K
> (9)    Pressure_Torr
> ncl 9> year = stringtoint(new_str(1:3325,0))
> ncl 10> month = stringtoint(new_str(1:3325,1))
> ncl 11> day = stringtoint(new_str(1:3325,2))
> ncl 12> hour = stringtoint(new_str(1:3325,3))
> ncl 13> minute = stringtoint(new_str(1:3325,4))
> ncl 14> second = stringtoint(new_str(1:3325,5))
> ncl 15> UT_sec = stringtofloat(new_str(1:3325,6))
> ncl 16> ozone_ppbv = stringtofloat(new_str(1:3325,7))
> ncl 17> Temp_K = stringtofloat(new_str(1:3325,8))
> ncl 18> Press_Pa = stringtofloat(new_str(1:3325,9))
> ncl 19> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> ncl 20> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ncl 21> begin
> ncl 22>f = addfile ("$NCARG_ROOT/lib/ncarg/data/ascii/TRODAN.dat.asc","r“)

here you try to open a file called  $NCARG_ROOT/lib/ncarg/data/ascii/TRODAN.dat.asc which doesn’t exist.
Shouldn’t it be  

f = addfile("/home/najib/Desktop/TRODAN.dat“,“r")

> ncl 23> u = f->U
> ncl 24> wks = gsn_open_wks ("ps","xy")
> ncl 25> res = True
> ncl 26> rest at tiMainString = "Basic XY plot"
> ncl 27> plot = gsn_csm_xy (wks,u&lat,u(1,{3325}),res)
> ncl 28> end
> fatal:["FileSupport.c":2758]:_NclFindFileExt: Requested file <$NCARG_ROOT/lib/ncarg/data/ascii/TRODAN.dat.asc> or <$NCARG_ROOT/lib/ncarg/data/ascii/TRODAN.dat> does not exist
> 

This error message says exactly what happened.


> fatal:["FileSupport.c":3052]:($NCARG_ROOT/lib/ncarg/data/ascii/TRODAN.dat.asc) has no file extension, can't determine type of file to open
> fatal:file (f) isn't defined
> fatal:["Execute.c":7741]:Execute: Error occurred at or near line 23
> 

And it tells you also at which line of your script you have to look.


Bye,
Karin




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-install/attachments/20150512/ca7b182f/attachment.html 


More information about the ncl-install mailing list