It is not clear to me what you want to do. Further, the code
snippet is not legal: eg: vNames = dimsizes(vNames)
fils = (/"station_data_1.nc","station_data_2.nc",..../)
nfils = dimsizes(fils)
f = addfile (fils(0),"r") ; read from 1st file
vNames = getfilevarnames(f)
print(vNames)
nv = ? ; use vNames to select the index
do nf=0,nfils-1
f = addfile (fils(nf),"r")
V = f->$vNames(nv-1)$
printVarSummary(V)
end do
===
The print(vNames) might look like
Variable: vNames
Type: string
Total Size: 48 bytes
5 values
Number of Dimensions: 1
Dimensions and sizes: [6]
Coordinates:
(0) lat
(1) lon
(2) gw
(3) time
(4) U
Then nv = 4
On 3/12/14, 11:52 PM, Steeven Paul Yerraguntla wrote:
> Hi NCL Users,
> I am using number of netcdf files having single variables and
> those are station time series data. I wanted to use the variable(like sst,
> airt but not lat, lon, depth etc) in the script using
> *getfilevarnames*function as follows.
>
> f = addfile ("station_data.nc","r")
> vNames = dimsizes(vNames)
> V=f->$vNames(*n-1*)$
>
> I am expecting the n value to be same(it is changing from file to file
> though they are of equal dimensions) for all netcdf files so that i need
> not worry about the mentioning of variable name in every script. In short,
> is there any way to extract variable name without mentioning it directly in
> the script?
>
> Thanks in advance
>
> regards,
> Paul.
>
>
>
> _______________________________________________
> 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 Thu Mar 13 07:04:20 2014
This archive was generated by hypermail 2.1.8 : Fri Mar 14 2014 - 15:08:52 MDT