- To: netcdf-java@xxxxxxxxxxxxxxxx
- Subject: [netcdf-java] Reduced Gaussian to Regular Lat/Lon Interpolation has odd spacing
- From: Jochen Kähler <jkaehler@xxxxxxxxxxxxxxx>
- Date: Thu, 17 Apr 2014 17:33:17 +0200
Hi all,
we’re using the netcdf lib to open Grib Files with Reduced Gaussian grids. 
Those are automatically interpolated to Regular Lat Lon by QuasiRegular.java as 
far as I got it. Also as far as I understood that code, I would expect equal 
spacings between the gridpoints. 
However: what we get out looks like this…
Latitude Dimension starting at Greenwich:
0.000000000°
0.140624851°
0.281249702°
0.421874553°
0.562499404°
0.703124285°
0.843749106°
0.984373927°
1.124998808°
1.265623689°
1.406248569°
1.546873331°
1.687498212°
1.828123093°
1.968747854°
2.109372854°
2.249997616°
2.390622377°
2.531247377°
2.671872139°
2.812497139°
2.953121901°
3.093746662°
3.234371662°
3.374996424°
3.515621185°
3.656246185°
3.796870947°
3.937495708°
4.078120708°
4.218745708°
4.359370232°
4.499995232°
4.640620232°
[…]
…which results to a spacings as follows:
0.140624851°
0.140624851°
0.140624851°
0.140624851°
0.140624881°
0.140624821°
0.140624821°
0.140624881°
0.140624881°
0.140624881°
0.140624762°
0.140624881°
0.140624881°
0.140624762°
0.140625°
0.140624762°
0.140624762°
0.140625°
0.140624762°
0.140625°
0.140624762°
0.140624762°
0.140625°
0.140624762°
0.140624762°
0.140625°
0.140624762°
0.140624762°
0.140625°
0.140625°
0.140624523°
0.140625°
0.140625°
0.140624523°
[…]
…similar for longitude, starting far north:
89.89239502°
89.75300598°
89.61279297°
89.47238922°
89.33191681°
89.19141388°
89.05088806°
88.91035461°
88.76980591°
88.6292572°
88.4887085°
88.34815216°
88.2075882°
88.06703186°
87.9264679°
87.78591156°
87.6453476°
87.50478363°
87.36421967°
87.22364807°
87.08308411°
86.94252014°
86.80194855°
86.66138458°
86.52082062°
86.38024902°
86.23968506°
86.09911346°
85.9585495°
85.81797791°
85.67741394°
85.53684235°
85.39627838°
85.25570679°
[…]
…spacings:
-0.139389038°
-0.140213013°
-0.140403748°
-0.140472412°
-0.14050293°
-0.140525818°
-0.140533447°
-0.140548706°
-0.140548706°
-0.140548706°
-0.140556335°
-0.140563965°
-0.140556335°
-0.140563965°
-0.140556335°
-0.140563965°
-0.140563965°
-0.140563965°
-0.140571594°
-0.140563965°
-0.140563965°
-0.140571594°
-0.140563965°
-0.140563965°
-0.140571594°
-0.140563965°
-0.140571594°
-0.140563965°
-0.140571594°
-0.140563965°
-0.140571594°
-0.140563965°
-0.140571594°
-0.140571594°
…a bit too much for being just rounding issues.
Does anyone know why the spacing isn’t equal?
BTW: used latest netcdfAll.jar V 4.3.21 and the code is as follows:
NetcdfFile grib = NetcdfFile.open("dsd_201201011200_120.grb");
NetcdfDataset nds = new NetcdfDataset(grib);
GridDataset gds = new GridDataset(nds);
for (GridDatatype var : gds.getGrids()) {
        if ("2_metre_temperature_surface".equals(var.getFullName())) {
                GridCoordSystem gcs = var.getCoordinateSystem();
                CoordinateAxis lon = gcs.getXHorizAxis();
                for (double value : (double[]) 
lon.read().get1DJavaArray(double.class)) {
                        System.out.println(value);
                }
                System.out.println("...........");
                CoordinateAxis lat = gcs.getYHorizAxis();
                for (double value : (double[]) 
lat.read().get1DJavaArray(double.class)) {
                        System.out.println(value);
                }
        }
}               
Thanks a lot in advance & happy easter! ;-)
JochenAttachment:
smime.p7s
Description: S/MIME cryptographic signature
- Follow-Ups:
