Why min/max are different from the actual range?

From: Wen.J.Qu <wen.j.qu_at_nyahnyahspammersnyahnyah>
Date: Fri Oct 19 2012 - 00:52:28 MDT

Hi, all

When I read a .nc file, printVarSummary shows the 3D variable "hgt" has an actual range of "-527, 32307 "

But when I use the line {print("hgt min/max = " + min(hgt) + "/" + max(hgt))} to print the min and max, it shows "hgt min/max = -27627/-26066"

Please help me to give some hint about the problem of this code. Is it from my calculation of min and max with the "short" data type? Is it from the wrong setting of the missing value? Or is it from my probably some wrong in reading the .nc file?

Thanks a lot in advance.

Shawn

##############################################################
code
##############################################################
           fil = systemfunc ("cd " + diri + " ; ls hgt."+YEAR+".nc")
           f = addfile(diri+fil,"r")
           ;Debugprint
           printVarSummary(f)
           hgt = f->hgt(:,5,:,:)
           ;Debugprint
           printVarSummary(hgt)
           print("hgt min/max = " + min(hgt) + "/" + max(hgt))
##############################################################

##############################################################
print result
##############################################################
Variable: hgt
Type: short
Total Size: 7673760 bytes
            3836880 values
Number of Dimensions: 3
Dimensions and sizes: [time | 365] x [lat | 73] x [lon | 144]
Coordinates:
            time: [17373888..17382624]
            lat: [90..-90]
            lon: [ 0..357.5]
Number Of Attributes: 19
  level : 500
  long_name : mean Daily Geopotential height
  actual_range : ( -527, 32307 )
  unpacked_valid_range : ( -700, 35000 )
  units : m
  add_offset : 32066
  scale_factor : 1
  missing_value : 32766
  precision : 0
  least_significant_digit : 0
  GRIB_id : 7
  GRIB_name : HGT
  var_desc : Geopotential height
  dataset : NCEP Reanalysis Daily Averages
  level_desc : Multiple levels
  statistic : Mean
  parent_stat : Individual Obs
  valid_range : ( -32766, 2934 )
  _FillValue : 32766
(0) hgt min/max = -27627/-26066

##############################################################

Wen.J.Qu
2012-10-19

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Oct 19 00:52:36 2012

This archive was generated by hypermail 2.1.8 : Tue Oct 23 2012 - 11:10:04 MDT