>I'm reading some ncdf files which have nan values. I know about the
>isnan_ieee and replace_ieeenan functions, but although isnan_ieee works
>on my data (by spitting a logical array that matches the nan locations
>correctly), replace_ieeenan is not working at all. I read that these
>functions may not be portable to all systems (I'm running redhat
>enterprise linux on a x86 system), but I'm puzzled that one would work
>and the other not. I'm using addfile with the "w" option, so I'd expect
>the data to be modifiable...
>
>Has anybody experienced a problem like this? Do you know a workaround?
==============
James forwarded an example file and script.
His original script contained:
fn="vintrt.2002032.4km.gd.nc"
data=addfile(fn,"w")
data->lat_at_units="degrees_north"
data->lon_at_units="degrees_east"
if (any(isnan_ieee(data))) then
value = -999.9
replace_ieeenan(data, value, 0)
data@_FillValue = value
end if
The problem is that the script is operating on the
"data" which is a referenceto a file. It is not
a regular variable on the file.
isnan_ieee and replace_ieeenan work on variables.
Here is a sample that works with additional print
statements for illustration.
x = data->teff ; read variable "teff"
printVarSummary(x)
nNaN = num(isnan_ieee(x))
nFill= num(ismissing(x))
print("nNaN="+nNaN+" nFill="+nFill)
if (any(isnan_ieee(x))) then
value = -999.9
replace_ieeenan(x, value, 0)
x@_FillValue = value
mNaN = num(isnan_ieee(x))
mFill= num(ismissing(x))
print("mNaN="+mNaN+" mFill="+mFill)
end if
--- good luck Variable: x Type: double Total Size: 32200000 bytes 4025000 values Number of Dimensions: 3 Dimensions and sizes: [time | 46] x [lat | 250] x [lon | 350] Coordinates: time: [731248.0104166666..731248.9895833334] lat: [41.98..32.02] lon: [255.02..268.98] Number Of Attributes: 0 (0) (0) nNaN=58995 nFill=0 (0) mNaN=0 mFill=58996 All "nan" values were replaced. _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Fri Feb 10 2006 - 11:47:17 MST
This archive was generated by hypermail 2.2.0 : Wed Feb 15 2006 - 21:20:14 MST