Re: How to read in different types of input

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 23 2009 - 11:20:43 MST

Correction ...

          if (rank.eq.4)
              x = a->$var_type(nv)$(0,:,:,:)
          end if

On 12/23/2009 11:07 AM, Dennis Shea wrote:
> On the command line:
> 'var_type=(/"TS","PS",.../)'
>
> In the script:
> nVar = dimsizes(var_type)
>
> do nv=0,nVar-1
> rank = dimsizes( getvardimsizes( a, var_type(nv)) )
> if (rank.eq.3)
> x = a->$var_type(nv)$(0,:,:)
> end if
>
> if (rank.eq.4)
> x = a->$var_type(nv)$(0,:,:,0)
> end if
>
> ; ..... code ......
>
> delete(x) ; rank may change with next variable
> end do
>
> ====
>
> On 12/23/2009 12:03 AM, Wee-Beng Tay wrote:
>> Hi,
>>
>> I have a netcdf file with variables like temperature, pressure,
>> velocity etc
>>
>> I want ncl to read in different types of input at different times
>> through command line and then plot them out.
>>
>> It's simple if I only need to plot 1 variables. In that case, I'll
>> use at the command line:
>>
>> e.g. ncl abc.ncl 'var_type="temperature"'
>>
>> if ((var_type) .eq. "temperature") then
>>
>> phi = a->TS(0,:,:) ; read temperature
>>
>> end if
>>
>> if ((var_type) .eq. "pressure") then
>>
>> phi = a->PS(0,:,:) ; read pressure
>>
>> end if
>>
>> However the problem arises when I need to plot more than 1 variable,
>> maybe 3 to 4. Supposed there's 4 variables and there's
>> phi1,phi2,phi3,phi4. How should I write the code to read in the
>> correct variables?
>>
>> Thanks again!
>>
>> Wee-Beng
>>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 23 11:21:59 2009

This archive was generated by hypermail 2.1.8 : Tue Dec 29 2009 - 10:29:16 MST