Thank you Dennis,
my main foul up was forgetting to add the extra 1 onto the dim ref values
when in fortran. But I still have some questions:
I have this 428,614 array. When I read this array in from the grib file,
it stays in this form (428,614). Then when I pass it to fortran through
WRAPIT, I'm required to put it in the form (614,428).
This seems the opposite to your explanation. As the array goes
(fast,slow) while in ncl, then when I call the fortran subroutine it flips
it to (slow,fast).
Micah Sklut email@example.com
Geography Department - University of Delaware
On Wed, 10 Aug 2005, Dennis Shea wrote:
> Have you read the mini-reference manual [pdf]
>> I am fairly confused on the dimension reording that takes place with
>> arrays in NCL and when they are passed through WRAPIT.
>> I have an array u(428,614), and when I pass it to a fortran program
>> through WRAPIT i have to declare the array as (614,428) in order for it to
>> pass through without an error. So, to me it seems like the dimensions
>> become switched when the array is passed to the fortran program.
> NCL is like C, the rightmost dimension varies fastest.
> In fortran, the leftmost dimension varies fastest.
> NCL: (2,3) <===> (3,2) :Fortran
> The fastest varying subscripts 'map' into one another.
> Remembering that NCL is 0-based while fortran is 1-based
> (0,0) <===> (1,1)
> (0,1) <===> (2,1)
> (0,2) <===> (3,1)
> (1,0) <===> (1,2)
> (1,1) <===> (2,2)
> (1,2) <===> (3,2)
>> However, my objective is to access individual elements of the array, and
>> a print(u(428,614) gives me -8.46 while in ncl, and u(614,428) gives a
>> different value in the fortran program. So, I haven't been able to figure
>> out what is going on.
> If the array in NCl has a size of (428,614), then you can not print
> its value via print(u(428,614)) because this is out of bounds.
> The last element would be print(u(427,613)) . NCL is zero based.
> Since NCL is 0-based and fortran is 1-based, a fortran reference of, say, (
> 202, 315) would be referenced in NCL as ( 314, 201)
>> I would greatly appreciate some clarification on how the dimensions are
>> interpreted as they go from ncl to fortran.
> See above: IMHO, one fundamental thing one should know in *any* language is
> dimension is the fastest varying.
>> I have attached my ncl, stub, and f90 file. Also, if you would like to
>> use my data file, it can be found along with the other 3 files at
>> As always, thanks for your help!
>> Micah Sklut firstname.lastname@example.org
>> Geography Department - University of Delaware
ncl-talk mailing list
This archive was generated by hypermail 2b29 : Thu Aug 11 2005 - 07:47:39 MDT