This repository has been archived by the owner on Sep 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 179
Constructing Gaussian latitude axis in GdsHorizCoordSys #627
Labels
Comments
Hmmm...that does look suspicious. Would you happen to have a copy of that file that I could take a look at? I just want to make sure I am going to the correct parts of the correct GRIB spec to see what it says. |
The particular file I was working with is at https://dl.dropboxusercontent.com/u/18229899/test.grb |
Posted pull request #639 to fix this. |
Hi @msdsoftware - I've scratched my head a bit, and I am leaning towards what you have done. Would it be ok if I used the test file you uploaded to write a test? |
Sure. It's a test file that someone else passed on to me to demonstrate a problem, and he did label it "test". As long as it looks like valid GRIB to you, I'd say go for it. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
A Panoply user wrote to complain that a map plot of temperature data on a Gaussian grid was displayed inverted. I found that IDV also plotted the data upside down. In the dataset in question, the 880 latitude values are supposed to run from negative to positive, from -89.844 to 89.844.
Poking around in the NJ code to determine how the values of the latitude axis were being calculated, I found something a bit suspicious.
The method
setGaussianLats
inucar.nc2.grib.GdsHorizCoordSys
seems to be where the action is, and I do see that it is receiving parameters la1 -89.844, la2 89.844. The first pass at determining bestStartIndex and bestEndIndex values comes up with 879 and 0 respectivelyWhere things look flaky is the ensuing if statement.
if (Math.abs(bestEndIndex - bestStartIndex + 1) != nyRaw) {
In the case in question, where bestStartIndex > bestEndIndex, the inequality condition is going to be satisfied and in the ensuing if clause, bestStartIndex and bestEndIndex get flipped. In the loop after that, the values for the lat axis end up running from positive to negative.
So what I'm getting around to asking is, shouldn't the above if statement instead read
if (Math.abs(bestEndIndex - bestStartIndex) + 1 != nyRaw) {
I'm pretty unfamiliar with GRIB internals and Gaussian grids, so I'm checking here for confirmation on my suspicion rather than simply filing a pull request.
The text was updated successfully, but these errors were encountered: