cssgrid does not ignore _FillValue

From: Travis O'Brien <tobrien_at_nyahnyahspammersnyahnyah>
Date: Thu, 26 Jun 2008 13:38:34 -0700

It appears that cssgrid_Wrap (and cssgrid) does not ignore missing
values (either @missing_value or @_FillValue) like the documentation
says. I discovered this when trying to interpolate station data (some
of which are missing data) using cssgrid.

The bug can be replicated by modifying the example script from the
cssgrid documentation on the NCL website:
_________________________
;**************************************************
;************ Load necessary ncl code *************
;**************************************************

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

begin

 ndata = 100
 rlat = new(ndata,float)
 rlon = new(ndata,float)
 fval = new(ndata,float)

;
 do i=0,ndata-1
   rlat(i) = -90. + 180.*rand()/32767.
   rlon(i) = -180. + 360.*rand()/32767.
 end do
 cartesian = css2c(rlat,rlon)
 fval = cartesian(0,:)2 + cartesian(1,:)2 - 0.5*cartesian(2,:)2
 fval@_FillValue = -1.0e20
 fval(32) = -1.0e20

 printVarSummary(fval)

;
; Set up the output grid.
;
 nx = 73
 ny = 143
 plat = 90.*fspan(-1.,1.,nx)
 plon = 180.*fspan(-1.,1.,ny)

;
; Calculate the interpolated function values.
;
 fint = cssgrid_Wrap(rlat,rlon,fval,plat,plon)

 print(avg(fint))

end
_______________________________
Running ncl on this gives the following output:
Variable: fval
Type: float
Total Size: 400 bytes
           100 values
Number of Dimensions: 1
Dimensions and sizes: [100]
Coordinates:
Number Of Attributes: 1
 _FillValue : -1e+20
(0) -7.442205e+17

Running this script and omitting the line fval(32) = -1.0e20
gives a value for avg(fint) of about 0.2, versus the value given here of
about -1e17.

NCL version:
   5.0.0
Output from uname -a:
   Linux nimbus.pmc.ucsc.edu 2.6.9-55.0.2.ELsmp #1 SMP Tue Jun 26
14:14:47 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux"

and on another machine:

NCL version:
   4.3.0
Output from uname -a:
   Linux localhost.localdomain 2.6.25.4-10.fc8 #1 SMP Thu May 22
22:58:37 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

Thank you,
-Travis-

-- 
Travis A. O'Brien
Graduate Student Researcher
Earth and Planetary Science Dept.
UC Santa Cruz
tobrien_at_ucsc.edu
(831) 459-3504
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 26 2008 - 14:38:34 MDT

This archive was generated by hypermail 2.2.0 : Thu Jun 26 2008 - 16:29:44 MDT