Closed kkats closed 7 years ago
Last 3 lines of output from example/example1.hs are
lon(i=25) = 60.0 lat(j=40) = 7.5 slice1(i=25,j=40) = 5799.977596112534
but checking example/z500-short.nc with other tools (such as GrADS) says the value at (60degE, 7.5degN) should be about 5855. This patch
--- a/examples/example1.hs +++ b/examples/example1.hs @@ -55,7 +55,7 @@ main = do Right slice1tmp <- getA nc zvar [0, 0, 0] [1, nlat, nlon] :: SVRet CShort let slice1 = SV.map (/ 9.8) $ coardsScale zvar slice1tmp :: SV.Vector CDouble putStrLn $ "length slice1 = " ++ show (length slice1) - let idx i j = (nlat - i) * nlon + (j - 1) + let idx i j = (nlat - j) * nlon + (i - 1) putStrLn $ "lon(i=25) = " ++ show (lon SV.! (25 - 1)) putStrLn $ "lat(j=40) = " ++ show (lat SV.! (nlat - 40)) putStrLn $ "slice1(i=25,j=40) = " ++ show (slice1 SV.! idx 25 40)
seems to fix the problem. Similaly i and j indexing in example/example3.hs also might be swapped.
i
j
Thanks for that! Well spotted. I've modified the example program. The fix will go into the next release, which I'll do when I've decided what to do about hmatrix support.
hmatrix
Last 3 lines of output from example/example1.hs are
but checking example/z500-short.nc with other tools (such as GrADS) says the value at (60degE, 7.5degN) should be about 5855. This patch
seems to fix the problem. Similaly
i
andj
indexing in example/example3.hs also might be swapped.