[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20041004: Possible bug in "ocean s-coordinate"



>From: Rich Signell <address@hidden>
>Organization: USGS
>Keywords: 200410041742.i94HgRUE000566 IDV ocean-s bug

Hi Rich-
>
>IDV-developer-folk,
>
>I think there is a problem with the implementation of the
>"ocean s-coordinate" in IDV 1.1.    I should have caught this
>sooner, but...

Oh, sure, now you tell us. ;-)

>In the attached CF 1.0 Compliant file containing s-coordinate
>model results for the Adriatic Sea, when I make a vertical slice
>using IDV across the deepest part of the Adriatic Sea, the top of the 
>section
>appears to be about 150 m below the sea surface, when in fact
>it should be about 10 m below the sea surface.
>
>In the CF Convention,
>
>
>        Ocean s-coordinate
>
>standard_name = "ocean_s_coordinate"
>
>/Definition:/
>
>z(n,k,j,i) = eta(n,j,i)*(1+s(k)) + depth_c*s(k) +
>             (depth(j,i)-depth_c)*C(k)
>
>  C(k) = (1-b)*sinh(a*s(k))/sinh(a) + 
>         b*[tanh(a*(s(k)+0.5))/(2*tanh(0.5*a)) - 0.5]
>
>where z(n,k,j,i) is height, positive upwards, relative to ocean datum 
>(e.g. mean sea level) at gridpoint (n,k,j,i), eta(n,j,i) is the height 
>of the ocean surface, positive upwards, relative to ocean datum at 
>gridpoint (n,j,i), s(k) is the dimensionless coordinate at vertical 
>gridpoint (k), and depth(j,i) is the distance from ocean datum to sea 
>floor (positive value) at horizontal gridpoint (j,i). The constants a, 
>b, and depth_c control the stretching.
>
>The format for the formula_terms attribute is
>
>formula_terms = "s: var1 eta: var2 depth: var3 a: var4 b: var5 depth_c: 
>var6"
>
>
>The parameters in this file are:
>
>depth_c=3
>a=3
>b=0.8
>
>and if we pick (approximating the deepest part of the adriatic):
>eta=0, depth=1200,
>
>we should get:
>C(k)      z(i)
>-0.979 -1174.9
>-0.937 -1124.8
>-0.895 -1073.6
>-0.850 -1019.4
>-0.801 -960.7
>-0.747 -896.0
>-0.687 -824.5
>-0.622 -746.3
>-0.552 -662.5
>-0.479 -575.2
>-0.406 -487.4
>-0.335 -402.4
>-0.269 -323.3
>-0.210 -252.2
>-0.158 -190.5
>-0.115 -138.3
>-0.079 -95.3
>-0.050 -60.2
>-0.027 -32.1
>-0.008  -9.5
>
>
>So the top of the vertical section in the deepest part of the basin should
>be more like 9.5 m (instead of 150 m)

Good detective work.  You get the prize for finding the bug of the
day.  The code in ucar.unidata.geoloc.vertical.OceanS.java was doing:

  C(k) = (1-b)*sinh(a*s(k))/sinh(a) + 
         b*[tanh(a*(s(k)+0.5))/(2*tanh(0.5*a))] - 0.5

Just a little matter of getting the parentheses in the right places.
I've put out a new idv.jar at:

ftp://ftp.unidata.ucar.edu/pub/idv/untested/idv.jar

Replace your version with this one (making a backup copy first of course).

The fix will be in the next release.  Also, your bundle pointed out
another bug that just got introduced in a recent change so you're
actually getting a 2-fer-1!

Thanks for finding this.

Don
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publicly available
through the web.  If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.

>Date:    Mon, 04 Oct 2004 16:14:50 EDT
>From:    Rich Signell <address@hidden>
>Subject: Re: 20041004: Possible bug in "ocean s-coordinate"
>
>Fantastic!  
>
>They like to say you get what you pay for, but I've never seen a piece 
>of *commercial* software where you get bugs fixed in a couple of *hours*!!!!
>
>Thanks,