Per my previous e-mail (see below): I believe I have found the
problem. The values returned from the dim_sum function exceeds the
short numeric data type in some cases. Here is my fix:
nlon = dimsizes(lon)
nbin = 55
glb_hist1 = new(nbin,long)
glb_hist = new((/nbin,nlon/),long)
-------- Original Message --------
Subject: [ncl-talk] Dim_sum_Wrap
Date: Tue, 25 Sep 2007 12:38:35 -0700
From: Scott Capps <scapps_at_uci.edu>
To: ncl-talk_at_ucar.edu
Good afternoon,
I am trying to ingest a test.nc file (lat=59.125 to 59.375; lon=150.125
to 299.875):
netcdf test {
dimensions:
lat = 2 ;
lon = 600 ;
bin = 55 ;
variables:
short bin_cnt(lat, lon, bin) ;
bin_cnt:missing_value = -999s ;
float lat(lat) ;
lat:units = "degrees_north" ;
lat:long_name = "latitude" ;
lat:_FillValue = -999.f ;
float lon(lon) ;
lon:units = "degrees_east" ;
lon:long_name = "longitude" ;
lon:_FillValue = -999.f ;
I would like to plot a histogram containing the sum of the counts per
bin for a portion of the globe using the NCL code below:
begin
data = addfile(test.nc,"r")
bin_cnt = data->bin_cnt
bin_cnt@_FillValue = floattoshort(-999)
glb_hist = dim_sum_Wrap(bin_cnt(bin|:,lon|:,lat|:))
glb_hist1 = dim_sum_Wrap(glb_hist(bin|:,lon|:)) ;Contains a bin count
for the entire globe
end
For some strange reason, the glb_hist1 array contains negative values
when the input variable (bin_cnt) does not. The bin_cnt variable
contains positive (short format) numbers. I can provide the test.nc
file on request.
-- Scott Capps University of California, Irvine Department of Earth System Science Croul Hall Irvine, CA 92617 -- Scott Capps University of California, Irvine Department of Earth System Science Croul Hall Irvine, CA 92617
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 25 2007 - 14:10:34 MDT
This archive was generated by hypermail 2.2.0 : Mon Oct 01 2007 - 07:42:01 MDT