comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » floating underflow errors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
floating underflow errors [message #30203] Wed, 10 April 2002 17:15
patrick is currently offline  patrick
Messages: 15
Registered: July 2001
Junior Member
Greetings All-

I've read through the fairly extensive history of posts regarding
floating underflow arithmetic error messages on the group and wanted
to see if anyone can suggest a fix for the problems I'm having. My
code is a simple interpolation to create a 2d contour of oceanographic
data values. Strangely enough I haven't always had the floating
underflow message popping up in my code but the data can be variable
depending on what coastal area the data is collected in. I believe the
problem is occurring either because there are actual zeros appearing
in the data files or as a result of the simple interpolation function
I'm using. I would ignore the message other than the code sometimes
crashes. Below is an example of the routine I'm running on a number of
fields and adjusting the scale appropriately. My question is can I
work around the problem by using a combination of 1) notification
about a floating underflow occurrence by using the !EXCEPT system
variable, and 2) applying the WHERE function to replace occurrences of
0 with a NaN or some other null value that won't otherwise affect the
outcome of my contour plot?

The data are organized as ascii arrays that interpolate between two
locations at the same depth for various fields.

Any suggestions are greatly appreciated,

Regards,

Patrick

code:

if (event.index eq 1) then begin


x1 = reform((*pstate).profiledata(4,*,0)) ; depth at 1
y1 = reform((*pstate).profiledata(4,*,1)) ; depth at 2

x2 = reform((*pstate).profiledata(6,*,0)) ; density at 1 f(x1)
y2 = reform((*pstate).profiledata(6,*,1)) ; density at 2 f(y1)



x2=x2[sort(x1)]
y2=y2[sort(y1)]
x1=x1[sort(x1)]
y1=y1[sort(y1)]

;print,(size(x1))[1],(size(y1))[1]
;print, x1, y1

x1=x1[0:(size(x1))[1]-1]
y1=y1[0:5684]
x2=x2[0:(size(x2))[1]-1]
y2=y2[0:5684]


; interpolate 1st data onto 2nd data alt grid
x2i = interpol(x2, x1, y1) ; density at 1 f(y1)
;x2i(0) = ABS(x2i(0))
badnum=fltarr(1)
badnum = FINITE(x2i, /INFINITY)
ndepth=(size(x2i))[1]
nsep=100

print,max(x2i),min(x2i),max(y2),min(y2)

dens=DBLARR(ndepth,nsep)
for d=0,ndepth-1 do begin
for s=0,nsep-1 do begin
dens[d,s]=x2i[d]+(y2[d]-x2i[d])*s/(nsep-1)
endfor
endfor

print,min(dens),max(dens)

sep=DINDGEN(nsep)/(nsep-1)
dep=DINDGEN(ndepth)/(ndepth-1)*(MAX(y1)-MIN(y1))+MIN(y1)

nlevels=10
levels=DINDGEN(nlevels)/(nlevels-1)*(max(dens)-min(dens))+mi n(dens)
labels=INTARR(nlevels)+1


contour,transpose(dens),sep,dep ,YRANGE=[max(y1),min(y1)], $
levels = [20.5,21.5,21.6, 21.7, $
21.8,21.9,22.0, 22.1] ,c_labels=labels, $
c_annotation = ['3.0','3.5','3.6', '3.7', $
'4.0','4.1','4.3', '4.6'],XTITLE = 'Space', YTITLE = 'Depth (m)', $
c_colors=[60,120,250], TITLE = 'Density (sigma-t)'


endif
[Message index]
 
Read Message
Previous Topic: ROUTINE_INFO problems
Next Topic: Where is "Pause" function?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:04:52 PDT 2025

Total time taken to generate the page: 0.00346 seconds