> I have an ncl routine that runs through to near the end and crashes with
> a "segmentation fault". I've narrowed down the cause to the following.
> When I add the following simple do loop structure at the end of the program,
> the complete program finishes successfully.
>
> do ar = 0,ncell-1
> print((/ar/))
> end do
>
> However, if I add an internal do loop, the program crashes with a
> segmentation fault. No prints of either "ar" or "v" occur.
> .
> .
> .
> Am I running up against some sort of system limitation? Could these loops be
> in conflict with something else in the program somehow? How could I
> troubleshoot this further?
>
> Thanks for the help,
>
> Keith
I just wanted to let everybody know that some internal discussion took
place on this topic, and Dennis Shea recommended that Keith get rid of
some of his loops by using the "conform" function. Once he did this,
the segmentation problem went away.
The "conform" function is documented at:
http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/conform.html
This function is very handy for expanding an n-dimensional array to
conform to another array which is a superset of it in size.
For example, assume you have a 3D array "x" with sizes "ntim" x "nlat"
x "mlon", and a 1D array "t" of length "ntim". You can expand "t" to
the size of "x" as follows:
tConform = conform (x,t,0)
The variable "tConform" will be dimensioned "ntim" x "nlat" x "mlon"
where the contents of "t" are propagated to all of the dimensions of
"x". The third argument tells "conform" which dimensions of "x" are
the same as the dimensions in "t" (in this case, the 0th dimension).
Here's a more complex example:
Assume you have a 4D array "x" with named dimensions ("time", "lev",
"lat", "lon") that is dimensioned "ntim" x "klvl" x "nlat" x "mlon",
and a 2D array "dp" that is dimensioned "ntim" x "klvl". Further
assume you want to reorder "x" to be ("time", "lat", "lon",
"lev"). Then, you can have "conform" work upon the reordered grid, and
the values of the third argument will then refer to the reordered
grid:
dpC = conform (x(time|:,lat|:,lon|:,lev|:), dp, (/0,3/))
Variable "dpC" will be dimensioned "ntim" x "nlat" x "mlon" x "klvl"
and will contain the values of "dp" as propagated to the other
dimensions.
--Mary
_______________________________________________
ncl-talk mailing list
ncl-talk AT ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Thu Sep 05 2002 - 07:26:57 MDT