Skip to content

Commit

Permalink
Add Canadian HT2_1997, HT2_1997_CGG2013a, HT2_2002v70 and HT2_2002v70…
Browse files Browse the repository at this point in the history
…_CGG2013a vertical grids
  • Loading branch information
rouault committed Aug 18, 2023
1 parent 49761e6 commit 7a08f5c
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 26 deletions.
Binary file added ca_nrc/ca_nrc_HT2_1997.tif
Binary file not shown.
Binary file added ca_nrc/ca_nrc_HT2_1997_CGG2013a.tif
Binary file not shown.
Binary file added ca_nrc/ca_nrc_HT2_2002v70.tif
Binary file not shown.
Binary file added ca_nrc/ca_nrc_HT2_2002v70_CGG2013a.tif
Binary file not shown.
Binary file modified ca_nrc/ca_nrc_HT2_2010v70_CGG2013a.tif
Binary file not shown.
46 changes: 45 additions & 1 deletion ca_nrc/ca_nrc_README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,29 @@ Transform between NAD27(76) and NAD83 in Canada.

* ca_nrc_SK83-98.tif

### Canada: CGVD28 height --> NAD83(CSRS)
### Canada: CGVD28 height --> NAD83(CSRS)v2 / NAD83(CRS)v3 (epoch 1997)

*Source*: [Natural Resources Canada](https://webapp.csrs-scrs.nrcan-rncan.gc.ca/geod/process/download-helper.php?file_id=HT2_1997)
*Format*: GeoTIFF converted from BYN
*License*: [Open Government Licence - Canada](http://open.canada.ca/en/open-government-licence-canada)
*Source CRS*: EPSG:8235 (NAD83(CSRS)v2)
*Target CRS*: EPSG:5713 (CGVD28 height)
*Used by*: [EPSG:9984 Transformation](https://www.epsg-registry.org/export.htm?gml=urn:ogc:def:coordinateOperation:EPSG::9984)

* ca_nrc_HT2_1997.tif

### Canada: CGVD28 height --> NAD83(CSRS)v4 (epoch 2002)

*Source*: [Natural Resources Canada](https://webapp.csrs-scrs.nrcan-rncan.gc.ca/geod/process/download-helper.php?file_id=HT2_2002)
*Format*: GeoTIFF converted from BYN
*License*: [Open Government Licence - Canada](http://open.canada.ca/en/open-government-licence-canada)
*Source CRS*: EPSG:8244 (NAD83(CSRS)v4)
*Target CRS*: EPSG:5713 (CGVD28 height)
*Used by*: [EPSG:9985 Transformation](https://www.epsg-registry.org/export.htm?gml=urn:ogc:def:coordinateOperation:EPSG::9985)

* ca_nrc_HT2_2002v70.tif

### Canada: CGVD28 height --> NAD83(CSRS)v6 / NAD83(CRS)v7 / NAD83(CSRS)v8 (epoch 2010)

*Source*: [Natural Resources Canada](https://webapp.geod.nrcan.gc.ca/geod/process/download-helper.php?file_id=HT2_2010)
*Format*: GeoTIFF converted from GTX
Expand Down Expand Up @@ -308,6 +330,28 @@ Transform between NAD27(76) and NAD83 in Canada.

* ca_nrc_CGG2013i08.tif

### Canada: CGVD28 height --> CGVD2013a(1997) height

*Source*: [Natural Resources Canada](https://webapp.csrs-scrs.nrcan-rncan.gc.ca/geod/process/download-helper.php?file_id=HT2_1997_CGG2013a)
*Format*: GeoTIFF converted from GeoTIFF
*License*: [Open Government Licence - Canada](http://open.canada.ca/en/open-government-licence-canada)
*Source CRS*: EPSG:5713 (CGVD28 height)
*Target CRS*: EPSG:20035 (CGVD2013a(1997) height)
*Used by*: [EPSG:10113 Transformation](https://epsg.org/transformation_10113/CGVD28-height-to-CGVD2013a-1997-height-1.html)

* ca_nrc_HT2_1997_CGG2013a.tif

### Canada: CGVD28 height --> CGVD2013a(2002) height

*Source*: [Natural Resources Canada](https://webapp.csrs-scrs.nrcan-rncan.gc.ca/geod/process/download-helper.php?file_id=HT2_1997_CGG2013a)
*Format*: GeoTIFF converted from GeoTIFF
*License*: [Open Government Licence - Canada](http://open.canada.ca/en/open-government-licence-canada)
*Source CRS*: EPSG:5713 (CGVD28 height)
*Target CRS*: EPSG:20034 (CGVD2013a(2002) height)
*Used by*: [EPSG:10113 Transformation](https://epsg.org/transformation_10114/CGVD28-height-to-CGVD2013a-2002-height-1.html)

* ca_nrc_HT2_2002v70_CGG2013a.tif

### Canada: CGVD28 height --> CGVD2013a(2010) height

*Source*: [Natural Resources Canada](https://webapp.csrs-scrs.nrcan-rncan.gc.ca/geod/process/download-helper.php?file_id=HT2_2010_CGG2013a_tif)
Expand Down
4 changes: 4 additions & 0 deletions copyright_and_licenses.csv
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ ca_nrc_CQ77SCRS.tif,"Her Majesty the Queen in right of Canada as represented by
ca_nrc_CRD27_00.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,,
ca_nrc_CRD93_00.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,,
ca_nrc_GS7783.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,,
ca_nrc_HT2_1997.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,1.15,
ca_nrc_HT2_2002v70.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,1.15,
ca_nrc_HT2_2010v70.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,,
ca_nrc_HT2_1997_CGG2013a.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,1.15,
ca_nrc_HT2_2002v70_CGG2013a.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,1.15,
ca_nrc_HT2_2010v70_CGG2013a.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,1.11,
ca_nrc_MAY76V20.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,,
ca_nrc_NA27SCRS.tif,"Her Majesty the Queen in right of Canada as represented by the Canadian Geodetic Survey, Natural Resources Canada",OGL-Canada-2.0,,
Expand Down
56 changes: 31 additions & 25 deletions grid_tools/vertoffset_grid_to_gtiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,32 +174,38 @@ def is_false_positive_nodata(y, x):
nodata = None if args.ignore_nodata else src_ds.GetRasterBand(
1).GetNoDataValue()
data = src_ds.GetRasterBand(1).ReadAsArray()
if nodata is None:
data = data / scale
else:
dst_nodata = 9999000
nodata_as_f = struct.pack('f', nodata)
has_warned_nodata = False
for y in range(src_ds.RasterYSize):
for x in range(src_ds.RasterXSize):
is_nodata = False
if struct.pack('f', data[y][x]) == nodata_as_f:
if is_false_positive_nodata(y, x):
pass
elif not has_warned_nodata:
print(
'At least one value matches nodata (at %d,%d). Setting it' % (y, x))
tmp_ds.GetRasterBand(
1).SetNoDataValue(dst_nodata)
has_warned_nodata = True
is_nodata = True
else:
is_nodata = True
if src_ds.GetRasterBand(1).DataType == gdal.GDT_Int32 and \
src_ds.GetRasterBand(1).GetScale() == 0.001:
tmp_ds.GetRasterBand(1).SetNoDataValue(nodata)
elif src_ds.GetRasterBand(1).GetScale() == 1:
if nodata is None:
data = data / scale
else:
dst_nodata = 9999000
nodata_as_f = struct.pack('f', nodata)
has_warned_nodata = False
for y in range(src_ds.RasterYSize):
for x in range(src_ds.RasterXSize):
is_nodata = False
if struct.pack('f', data[y][x]) == nodata_as_f:
if is_false_positive_nodata(y, x):
pass
elif not has_warned_nodata:
print(
'At least one value matches nodata (at %d,%d). Setting it' % (y, x))
tmp_ds.GetRasterBand(
1).SetNoDataValue(dst_nodata)
has_warned_nodata = True
is_nodata = True
else:
is_nodata = True

if is_nodata:
data[y][x] = dst_nodata
else:
data[y][x] = data[y][x] / scale
if is_nodata:
data[y][x] = dst_nodata
else:
data[y][x] = data[y][x] / scale
else:
assert False

tmp_ds.GetRasterBand(1).WriteArray(data)
tmp_ds.GetRasterBand(1).SetOffset(0)
Expand Down
4 changes: 4 additions & 0 deletions travis/expected_main.lst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ ca_nrc_CQ77SCRS.tif
ca_nrc_CRD27_00.tif
ca_nrc_CRD93_00.tif
ca_nrc_GS7783.tif
ca_nrc_HT2_1997.tif
ca_nrc_HT2_1997_CGG2013a.tif
ca_nrc_HT2_2002v70.tif
ca_nrc_HT2_2002v70_CGG2013a.tif
ca_nrc_HT2_2010v70.tif
ca_nrc_HT2_2010v70_CGG2013a.tif
ca_nrc_MAY76V20.tif
Expand Down

0 comments on commit 7a08f5c

Please sign in to comment.