Dear NCL Users,
I was able to read a csv file containing hourly air remperature data
of a day using following code.
begin
filename="/root/Desktop/AirTemperature(1).csv"
data=asciiread(filename,-1,"string")
delim=","
tfs=str_fields_count(data,delim)
field1 = (str_get_field(data(1:24),1,","))
field2 = (str_get_field(data(1:24),2,","))
field3 = stringtofloat(str_get_field(data(1:24),3,","))
field4 = stringtofloat(str_get_field(data(1:24),4,","))
field5 = stringtofloat(str_get_field(data(1:24),5,","))
print ("Date="+field1+" time="+field2+" Min="+field3 +"
Max="+field4+" Avg="+field5)
end
But, I need to calculate the monthly average on air temperature for
which I have to read multiple csv files. I wrote couple of codes which
are as follows but it didn't work.
begin
dir="/root/Desktop/filecsv/"
files=systemfunc("ls "+dir+"Air*")
print(files)
printVarSummary(files)
print(files(0))
f = addfiles (files, "r")
ListSetType (f, "cat")
data=asciiread(f,-1,"string")
delim=","
end
Can you please help me to work with multiple csv file ?. For your kind
reference, I have attached one of my csv file herewith.
Thanks & Regards,
Sangeeta Maharjan.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Wed Aug 07 2013 - 13:59:00 MDT