pacificclimate / climate-explorer-data-prep

0 stars 0 forks source link

Non-monotonic longitudes in netCDF file #11

Open corviday opened 7 years ago

corviday commented 7 years ago

NetCDF files are sometimes generated with longitudes that go from 0 to 180 and then from -180 to 0, like this:

ncdump -v lon tasmax_aClim_CanESM2_historical_r3i1p1_19610101-19901231.nc 

netcdf tasmax_aClim_CanESM2_historical_r3i1p1_19610101-19901231 {
dimensions:
    ...

// global attributes:
   ...

data:

 lon = 0, 2.8125, 5.625, 8.4375, 11.25, 14.0625, 16.875, 19.6875, 22.5, 
    25.3125, 28.125, 30.9375, 33.75, 36.5625, 39.375, 42.1875, 45, 47.8125, 
    50.625, 53.4375, 56.25, 59.0625, 61.875, 64.6875, 67.5, 70.3125, 73.125, 
    75.9375, 78.75, 81.5625, 84.375, 87.1875, 90, 92.8125, 95.625, 98.4375, 
    101.25, 104.0625, 106.875, 109.6875, 112.5, 115.3125, 118.125, 120.9375, 
    123.75, 126.5625, 129.375, 132.1875, 135, 137.8125, 140.625, 143.4375, 
    146.25, 149.0625, 151.875, 154.6875, 157.5, 160.3125, 163.125, 165.9375, 
    168.75, 171.5625, 174.375, 177.1875, -180, -177.1875, -174.375, 
    -171.5625, -168.75, -165.9375, -163.125, -160.3125, -157.5, -154.6875, 
    -151.875, -149.0625, -146.25, -143.4375, -140.625, -137.8125, -135, 
    -132.1875, -129.375, -126.5625, -123.75, -120.9375, -118.125, -115.3125, 
    -112.5, -109.6875, -106.875, -104.0625, -101.25, -98.4375, -95.625, 
    -92.8125, -90, -87.1875, -84.375, -81.5625, -78.75, -75.9375, -73.125, 
    -70.3125, -67.5, -64.6875, -61.875, -59.0625, -56.25, -53.4375, -50.625, 
    -47.8125, -45, -42.1875, -39.375, -36.5625, -33.75, -30.9375, -28.125, 
    -25.3125, -22.5, -19.6875, -16.875, -14.0625, -11.25, -8.4375, -5.625, 
    -2.8125 ;
}

There is no geographic discontinuity in this file, but there is a numerical discontinuity. Some software tools, such as ncWMS and CDO, have trouble working with the bounding boxes of polygons which span across the -180/180 longitude line, and have positive longitude minimums and negative longitude maximums.

ncWMS's response to requesting a map for an area that crosses the numerical discontinuity is:

<ServiceExceptionReport version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.3.0/exceptions_1_3_0.xsd"><ServiceException>
        Invalid bounding box format
    </ServiceException></ServiceExceptionReport>

Currently we anticipate no concrete repercussions from this issue, since all our use cases involve displaying maps of Canada, which does not go anywhere near the antemeridian. So it's low priority.

corviday commented 7 years ago

ncWMS also returns this response to a metadata request with a bounding box that crosses the discontinuity:

<ServiceExceptionReport version="1.1.1" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wms/1.1.1/exceptions_1_1_1.xsd"><ServiceException>
        Problem parsing parameters
    </ServiceException></ServiceExceptionReport>