<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
One more I just saw: <br>
<br>
5) You are assigning <tt>AODVIS@_FillValue</tt>, and then
immediately deleting it. (a) This is pointless, (b) You should only
need to assign the fill value if the value assigned when the grib is
read is incorrect for some reason (rare), (c) zero is generally not
used as a fill value (remember that anything equal to the fill value
will be treated as missing and ignored in most NCL computations).<br>
<br>
- Walter<br>
<br>
<div class="moz-cite-prefix">On 05-Jun-15 13:56, Walter Kolczynski
wrote:<br>
</div>
<blockquote cite="mid:5571E2B5.6040101@noaa.gov" type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
Steven,<br>
<br>
Several things:<br>
<br>
1) You didn't create the AODSum array with two dimensions, you
created an array with one dimension of length 2 (check your
printVarSummary). To create a multi-dimensional array with new you
need to pass in an array of the dimension sizes.<br>
2) NCL has functions to average over a specified dimension. You
should read all of your files in at once with <tt>a[:]->VAR_147_GDS0_EATM</tt>
and then use <tt>dim_avg_n_Wrap</tt> to average. This will both
be cleaner (no need for an AODSum at all) and eliminate the do
loop (which are slow in interpreted languages such as NCL).<br>
3) Since you want to create a new record dimension when reading in
the variables, you should be using "join" mode instead of the
default "cat" for your file list by calling <tt>ListSetType(a,
"join")</tt>.<br>
4) Because you are reading in LAT and LON across all files, you
are creating an array that has multiple copies of the lat/lon
arrays, which is likely not what you want. Since lat/lon do not
change, you should just read them from the first file in the array
(<tt>a[0]</tt>), plus...<br>
4a) You do not need to assign LAT and LON as attributes of AODVIS.
They are already coordinates for the appropriate dimensions of
AODVIS.<br>
<br>
- Walter<br>
<br>
<div class="moz-cite-prefix">On 05-Jun-15 12:15, BLIUJUS, STEVEN D
CTR USAF AFMC AFLCMC/HBAW-OL wrote:<br>
</div>
<blockquote
cite="mid:6767290C05D9574E86E3136BFB4162F55EB8D0EA@52APCA-D08-04D.area52.afnoapps.usaf.mil"
type="cite">
<pre wrap="">I am trying to take an average of a value in several files. The values are
an array. In this case the Variable is AOD which is based on Lat/Lon. I can
manually sum them and create and average, but I am trying to create a do
loop such that if I have several files (40) I can average that value. All
files have the exact same lat/lon, just the AOD value is different. I have
attached two scripts. The first one is gribtest.ncl. This script is where I
manually add the two files. The other attached is AOD.ncl. This is where I
am trying to create a do loop. I am trying to create an empty array before
the do loop called AODSum. However, when the loop executes I dies when
trying to add with the message:
fatal:Plus: Number of dimensions do not match, can't continue
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 37 in file
AOD.ncl
(0) Error: scalar_field: If the input data is 1-dimensional, you must
set sfXArray and sfYArray to 1-dimensional arrays of the same length.
warning:create: Bad HLU id passed to create, ignoring it
I created the array with two dimensions so I am not sure why it is failing.
The two files are much too large to send via email, so if those need to be
viewed I'd have to send them another way. Here is all the variable summaries
though:
Variable: LAT
Type: float
Total Size: 2888 bytes
722 values
Number of Dimensions: 1
Dimensions and sizes: [g0_lat_1 | 722]
Coordinates:
g0_lat_1: [-90..90]
Number Of Attributes: 9
long_name : latitude
GridType : Cylindrical Equidistant Projection Grid
units : degrees_north
Dj : 0.5
Di : 0.5006954
Lo2 : 360
La2 : 90
Lo1 : 0
La1 : -90
Variable: LON
Type: float
Total Size: 5760 bytes
1440 values
Number of Dimensions: 1
Dimensions and sizes: [g0_lon_2 | 1440]
Coordinates:
g0_lon_2: [ 0..360]
Number Of Attributes: 9
long_name : longitude
GridType : Cylindrical Equidistant Projection Grid
units : degrees_east
Dj : 0.5
Di : 0.5006954
Lo2 : 360
La2 : 90
Lo1 : 0
La1 : -90
Variable: AODSum
Type: float
Total Size: 8 bytes
2 values
Number of Dimensions: 1
Dimensions and sizes: [2]
Coordinates:
Number Of Attributes: 1
_FillValue : 9.96921e+36
Variable: AODVIS
Type: float
Total Size: 1039680 bytes
259920 values
Number of Dimensions: 2
Dimensions and sizes: [g0_lat_1 | 361] x [g0_lon_2 | 720]
Coordinates:
g0_lat_1: [-90..90]
g0_lon_2: [ 0..360]
Number Of Attributes: 15
LON : <ARRAY of 1440 elements>
LAT : <ARRAY of 722 elements>
sub_center : Ocean Prediction Center
center : U.S. Air Force - Global Weather Center
long_name : Unknown Variable Name
units : unknown
_FillValue : 1e+20
level_indicator : 200
gds_grid_type : 0
parameter_table_version : 129
parameter_number : 147
level : 0
forecast_time : 0
forecast_time_units : hours
initial_time : 07/20/2010 (00:00)
Steven Bliujus, Contractor
SEMS/16WS WXE
557th Weather Wing
DNS: 232-7151
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
ncl-talk mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Walter Kolczynski, Jr.
Global Ensemble Team
NOAA/NWS/NCEP/EMC (via I.M. Systems Group)
(301) 683-3781</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Walter Kolczynski, Jr.
Global Ensemble Team
NOAA/NWS/NCEP/EMC (via I.M. Systems Group)
(301) 683-3781</pre>
</body>
</html>