addfiles clobbers variables

From: Andrew Woolf (awo AT XXXXXX)
Date: Sun Sep 02 2001 - 08:14:35 MDT


I'm using NCL for the first time, so I hope I'm not doing something
stupid!

I have a bundle of GRIB files containing 2-d (lat/lon) data on different
levels. I'm trying to read the data in as shown below. The problem is
that for some reason the value of SALTY that I print as
a diagnostic is different for each of the following three cases:

[A] TMP is read in at the position shown below;
[B] TMP is instead read after the salinity files have been opened, ie
 immediately after the comment labelled [B] below;
[C] TMP is not read in at all.

In the case of the code below, the value of the salinity point is equal to
a temperature (deg K in my case). It appears as though there is some
kind of clobbering of memory going on.

Has anyone seen this sort of problem before, or have any suggestions?

Note the problem occurs also if I only read in values, ie use
(/ temperature_files[:]->TMP_GDS0_DBSL /) and
(/ salinity_files[:]->SALTY_GDS0_DBSL /) on the RHS of the assignments.

Regards,
 - Andrew
 
 

  begin
   ; Pre-define array of level depths...
    depth = (/ 96,139,204,301,447,666,996,1501,2116,2731,3347,3962,4577,5192 /)

   ; Temperature...
    print("Reading temperature...")
    temperature_file_names = "F00TX" + sprinti("%03d",depth) + "A.grb"
    temperature_files = addfiles(temperature_file_names,"r")
    ListSetType(temperature_files,"join")
   ; [A] Read in TMP after opening TMP files...
    TMP = temperature_files[:]->TMP_GDS0_DBSL

   ; Salinity...
    print("Reading salinity...")
    salinity_file_names = "F00SX" + sprinti("%03d",depth) + "A.grb"
    salinity_files = addfiles(salinity_file_names,"r")
    ListSetType(salinity_files,"join")
   ; [B] Read in TMP after SALTY files also opened...
    SALTY = salinity_files[:]->SALTY_GDS0_DBSL

   ; Test a particular salinity value...
    print(SALTY(13,178,276))

  end

-----------------------------------------------------
Andrew Woolf (awo AT mail.nerc-essc.ac.uk)
Environmental Systems Science Centre (ESSC)
Reading University
3 Earley Gate
Whiteknights
Reading RG6 6AL
UNITED KINGDOM
Phone: +44 (0)118 931 8741 Fax: +44 (0)118 931 6413
-----------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Feb 19 2002 - 09:06:06 MST