Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

NCEI CUDEMs on the Washington Outer Coast

Map and lists of versions found on the NCEI website

Under development for the Cascadia CoPes Hub project, supported by NSF.

This is an attempt to catalog the CUDEM tiles available on NCEI servers, either as GeoTiff (.tif) files or as netCDF (.nc) files, showing the year released and whether they are referenced to NAVD88 or MHW.

%matplotlib inline
from pylab import *
from importlib import reload
import folium
%%capture topo_sources

import find_topo_source
reload(find_topo_source)  # to make sure output is captured
topo_sources()
List of catalogs found in /Users/rjl/git/CHTuser/topo/topo_sources_cascadia.md:
Warning: This list may not be up to date!
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/crm/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/regional/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/pmel/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/tiles/tiled_19as/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/tiles/tiled_13as/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/tiles/nthmp/tiled_19as/catalog.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_bellingham/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_juandefuca/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_outercoast/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_pugetsound/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/columbia_river/index.html
List of catalogs found in /Users/rjl/git/CHTuser/topo/topo_sources_cascadia.md:
Warning: This list may not be up to date!
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/crm/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/regional/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/pmel/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/tiles/tiled_19as/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/tiles/tiled_13as/catalog.html
  Catalog =  https://www.ngdc.noaa.gov/thredds/catalog/tiles/nthmp/tiled_19as/catalog.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_bellingham/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_juandefuca/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_outercoast/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/wash_pugetsound/index.html
  Catalog =  https://coast.noaa.gov/htdata/raster2/elevation/NCEI_ninth_Topobathy_2014_8483/columbia_river/index.html
<module 'find_topo_source' from '/Users/rjl/git/CHTuser/topo/find_topo_source.py'>

Select a set of tiles

Specify the NW corner of the 0.25 x 0.25 degree tiles to search for:

eighth = 1/8  # half tile width, 0.0125 degrees

yNWs = arange(46.5, 48.6, 0.25)
xNWs = arange(-125.0, -123.4, 0.25)
    
# make list of tile names (north to south):
tile_names = []
for yNW in yNWs[-1::-1]:
    for xNW in xNWs:
        # midpoint of tile is (xm,ym):
        xm = xNW+eighth
        ym = yNW-eighth
        tile_name = find_topo_source.tile_coords(xm,ym,verbose=False)
        #print(f'midpoints: {xm:.3f}, {ym:.3f}, NW corner:  {x:.3f}, {y:.3f}, tile: {tile_name}')
        tile_names.append(tile_name)

Search for tiles in catlogs:

%%capture tile_sources_summary

print('Versions of tiles found in these catalogs:')
versions_mhw = {}
versions_navd88 = {}
for tile_name in tile_names:
    versions_mhw[tile_name] = []
    versions_navd88[tile_name] = []
    tile_urls = find_topo_source.find_tile_url(tile_name, verbose=False)
    for url in tile_urls:
        if url[-3:]=='.nc':
            vinfo = url[-9:]
        else:
            vinfo = url[-10:]
        if 'v' not in vinfo:
            vinfo = vinfo[2:]
        if 'nthmp' in url:
            versions_mhw[tile_name].append(vinfo)
        else:
            versions_navd88[tile_name].append(vinfo)
    print(f'    {tile_name}, MHW: {str(versions_mhw[tile_name]):>14}' \
            +f'   NAVD88: {str(versions_navd88[tile_name])}')

The summary generated is printed out below the map.

Map of tiles

m = folium.Map(location=(47.5,-125), zoom_start=8, height=800, scrollWheelZoom=False)

for y in yNWs[-1::-1]:
    for x in xNWs:
        xm = x+eighth
        ym = y-eighth
        tile_name = find_topo_source.tile_coords(xm,ym,verbose=False)
        popup = f'<b>{tile_name}</b>'
        for vinfo in versions_mhw[tile_name]:
            popup = popup + f'\n<font color="green">{vinfo}</font>'
        for vinfo in versions_navd88[tile_name]:
            popup = popup + f'\n<font color="blue">{vinfo}</font>'
        folium.Marker(
            location=[y-eighth,x+eighth],
            popup = popup,
            tooltip = "Click for info",
            #tooltip = f"<b>Tile:</b>\n {tile_name}",
            icon=folium.Icon(color="red", icon="info-sign") # Customize the marker's appearance
        ).add_to(m) 
        x1 = x
        x2 = x + 0.25
        y1 = y - 0.25
        y2 = y

        if len(versions_mhw[tile_name])>0 and len(versions_navd88[tile_name])>0:
            color = 'green'
            tip = 'MHW and NAVD88'
        elif len(versions_navd88[tile_name])>0:
            color = 'blue'
            tip = 'NAVD88 only'
        else:
            color = 'red'
            tip = 'not found'
        
        folium.Polygon(
            locations=[[y1,x1], [y1,x2], [y2,x2], [y2,x1]],
            color="black", # Outline color
            weight=1,
            fill=True,
            fillColor=color,
            fillOpacity=0.2,
            tooltip=tip
        ).add_to(m)

for lat in arange(yNWs[0]-0.25, yNWs[-1]+.1, 0.25):
    folium.PolyLine(
           [[lat,-125.25], [lat,-123.25]],
           color='black', weight=1, opacity=0.5
       ).add_to(m)

    #Add label at edge
    folium.Marker(
        [lat+0.05, -125.25],
        icon=folium.DivIcon(html=f'<div style="font-size: 12pt; color: gray;">{lat}°</div>')
        ).add_to(m)

# save as stand-alone html file:
fname = 'WAcoast-Tiles-Map.html'
m.save(fname)
print('Created ',fname)

# display map inline:
m
Created  WAcoast-Tiles-Map.html
Loading...

The stand-alone map can be viewed at interactive map.

Clicking on an info marker shows a summary of what files are available (in green if MHW, blue if NAVD88).

Tabular summary of what file versions were found:

tile_sources_summary()
Versions of tiles found in these catalogs:
    n48x50_w125x00, MHW:             []   NAVD88: ['2018v1.nc', '2025v1.tif']
    n48x50_w124x75, MHW:    ['2020.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n48x50_w124x50, MHW:  ['2021v1.nc']   NAVD88: ['2021v1.tif']
    n48x50_w124x25, MHW:  ['2021v1.nc']   NAVD88: ['2021v1.tif']
    n48x50_w124x00, MHW:             []   NAVD88: []
    n48x50_w123x75, MHW:             []   NAVD88: []
    n48x50_w123x50, MHW:             []   NAVD88: []
    n48x25_w125x00, MHW:             []   NAVD88: ['2018v1.nc', '2025v1.tif']
    n48x25_w124x75, MHW:    ['2020.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n48x25_w124x50, MHW:  ['2021v1.nc']   NAVD88: ['2021v1.tif']
    n48x25_w124x25, MHW:  ['2021v1.nc']   NAVD88: ['2021v1.tif']
    n48x25_w124x00, MHW:  ['2021v1.nc']   NAVD88: ['2021v1.tif']
    n48x25_w123x75, MHW:  ['2021v1.nc']   NAVD88: ['2021v1.tif']
    n48x25_w123x50, MHW:  ['2021v1.nc']   NAVD88: ['2021v1.tif']
    n48x00_w125x00, MHW:             []   NAVD88: []
    n48x00_w124x75, MHW:    ['2020.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n48x00_w124x50, MHW:    ['2020.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n48x00_w124x25, MHW:             []   NAVD88: []
    n48x00_w124x00, MHW:             []   NAVD88: []
    n48x00_w123x75, MHW:             []   NAVD88: []
    n48x00_w123x50, MHW:             []   NAVD88: []
    n47x75_w125x00, MHW:             []   NAVD88: []
    n47x75_w124x75, MHW:             []   NAVD88: ['2018v1.nc', '2025v1.tif']
    n47x75_w124x50, MHW:    ['2020.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n47x75_w124x25, MHW:             []   NAVD88: []
    n47x75_w124x00, MHW:             []   NAVD88: []
    n47x75_w123x75, MHW:             []   NAVD88: []
    n47x75_w123x50, MHW:             []   NAVD88: []
    n47x50_w125x00, MHW:             []   NAVD88: []
    n47x50_w124x75, MHW:             []   NAVD88: []
    n47x50_w124x50, MHW:    ['2020.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n47x50_w124x25, MHW:    ['2020.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n47x50_w124x00, MHW:             []   NAVD88: []
    n47x50_w123x75, MHW:             []   NAVD88: []
    n47x50_w123x50, MHW:             []   NAVD88: []
    n47x25_w125x00, MHW:             []   NAVD88: []
    n47x25_w124x75, MHW:             []   NAVD88: []
    n47x25_w124x50, MHW:             []   NAVD88: ['2018v1.nc', '2025v1.tif']
    n47x25_w124x25, MHW: ['2020.nc', '2025v1.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n47x25_w124x00, MHW:  ['2025v1.nc']   NAVD88: ['2025v1.tif']
    n47x25_w123x75, MHW:  ['2025v1.nc']   NAVD88: ['2025v1.tif']
    n47x25_w123x50, MHW:             []   NAVD88: []
    n47x00_w125x00, MHW:             []   NAVD88: []
    n47x00_w124x75, MHW:             []   NAVD88: []
    n47x00_w124x50, MHW:             []   NAVD88: []
    n47x00_w124x25, MHW:  ['2025v1.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n47x00_w124x00, MHW:  ['2025v1.nc']   NAVD88: ['2018v1.nc', '2025v2.tif']
    n47x00_w123x75, MHW:  ['2025v1.nc']   NAVD88: ['2025v1.tif']
    n47x00_w123x50, MHW:  ['2025v1.nc']   NAVD88: ['2025v1.tif']
    n46x75_w125x00, MHW:             []   NAVD88: []
    n46x75_w124x75, MHW:             []   NAVD88: []
    n46x75_w124x50, MHW:             []   NAVD88: []
    n46x75_w124x25, MHW:  ['2025v1.nc']   NAVD88: ['2025v1.tif']
    n46x75_w124x00, MHW:  ['2025v1.nc']   NAVD88: ['2025v1.tif']
    n46x75_w123x75, MHW:  ['2025v1.nc']   NAVD88: ['2025v1.tif']
    n46x75_w123x50, MHW:             []   NAVD88: []
    n46x50_w125x00, MHW:             []   NAVD88: []
    n46x50_w124x75, MHW:             []   NAVD88: []
    n46x50_w124x50, MHW:             []   NAVD88: []
    n46x50_w124x25, MHW:             []   NAVD88: ['2024v1.tif']
    n46x50_w124x00, MHW:             []   NAVD88: ['2024v1.tif']
    n46x50_w123x75, MHW:             []   NAVD88: ['2024v1.tif']
    n46x50_w123x50, MHW:             []   NAVD88: ['2024v1.tif']
tile_versions_summary_fname = 'WAcoast-CUDEM-Tiles-Summary.txt'
with open(tile_versions_summary_fname,'w') as tv_file:
    tv_file.write('WAcoast CUDEM tiles\n\n')
    tv_file.write(topo_sources.stdout)
    tv_file.write('\n\n')
    tv_file.write(tile_sources_summary.stdout)
    tv_file.write('\n\nFor more details see ')
print('Created ', tile_versions_summary_fname)
Created  WAcoast-CUDEM-Tiles-Summary.txt

Versions of these tiles found on NCEI webpages

Print out more details of which catalogs the above tiles are found in, and their URLs:

(Note that some of the .nc files are labelled as NAVD88 if their URL does not contain nthmp. Is this always correct?)

%%capture tile_sources_text

print('CUDEM tiles found on the WA Coast:\n')
tile_names = []
for y in yNWs[-1::-1]:
    print('\n=====================')
    print(f'Latitude y = {y:.2f}:')
    print('=====================')

    for x in xNWs:
        xm = x+eighth
        ym = y-eighth
        tile_name = find_topo_source.tile_coords(xm,ym,verbose=False)
        print('\n------------------------------------------------')
        print(f'Tile: {tile_name},  NW corner:  {x:.3f}, {y:.3f}')
        tile_names.append(tile_name)
        tile_urls = find_topo_source.find_tile_url(tile_name, verbose=True)
        if len(tile_urls) == 0:
            print(f'   Not found')
tile_versions_fname = 'WAcoast-CUDEM-Tiles.txt'
with open(tile_versions_fname,'w') as tv_file:
    tv_file.write('WAcoast CUDEM tiles\n\n')
    tv_file.write(topo_sources.stdout)
    tv_file.write('\n\n')
    tv_file.write(tile_sources_text.stdout)
print('Created ', tile_versions_fname)
Created  WAcoast-CUDEM-Tiles.txt

See WAcoast-CUDEM-Tiles.txt for the output, or execute the next cell to see the output here...

#tile_sources_text()