Re: write_matrix

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu, 10 Jan 2008 10:41:19 -0700

Hi Larry,

write_matrix expects a 2 dimensional array to be input as the first
argument. You have tmax(i,:), which means you are inputting a
1-dimensional array.

I see why you have the do loop in there as you are checking another
array to determine whether to write tmax to the ascii file or not.
However, I don't think the current code structure will work. I would
suggest you create a new array named tmax2 that only contains the data
that you wish to write out.

For instance (untested):

tmax2 = tmax

cntr = 0
do i=0,numbersta-1
    if (details(i,0).eq.391032) then
       tmax2(cntr,:) = tmax(i,:)
       cntr = cntr+1
    end if
end do
delete(tmax)
tmax3 = tmax2(:cntr-1,:)
delete(tmax2)

opt = True
opt_at_tspace = 3
opt_at_fout = "391032.out"
write_matrix(tmax3, "20089f5.1" , opt)

Good luck,
Adam

Larry McDaniel wrote:
> what am I not understanding here?
>
> Larry
>
> ncl < draft1.ncl
> Copyright (C) 1995-2007 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.0.0
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> fatal:Number of dimensions in parameter (0) of (write_matrix) is (1),
> (2) dimensions were expected
> fatal:Execute: Error occurred at or near line 50
>
> this the offending snip it:
>
> do i = 0, numbersta - 1
> if (details(i,0).eq.391032) then
> opt = True
> opt_at_tspace = 3
> opt_at_fout = "391032.out"
> x = tmax(i,:)
> write_matrix(tmax(i,:), "f5.1" , opt)
> end if
> end do
>
>
> tmax is defined as tmax(107,20089)
>

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 10 2008 - 10:41:19 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 10 2008 - 17:17:15 MST