NHD 2.31 and WBD 2.31 Data Models Released – Note Case Changes

Release Date:

NHD 2.31 and WBD 2.31 data models have been released. Please note python code snippet changes.

All new USGS hydrography products and map services will use these data models.

The 2.31 data model changes consist of: 

  1. Changing all feature class and table attribute names to lower case due to a change in database platform migration.
     
  2. Adding attribute aliases to all feature class and table attributes. Aliases contains the CamelCase representation of the attribute name.

  

  attribute name  attribute alias 
NHD 2.3  Permanent_Identifier   
NHD 2.31  permanent_identifier  Permanent_Identifier 

This attribute name casing change was necessary because of an internal database platform migration that switched the native storage of attribute names from all upper case to all lower case. Previously, USGS has changed the attribute names casing to CamelCase (from all upper case). The change to all lower case attribute names will allow more consistency between products and editing versions of the databases, allow for better interoperability between formats and platforms, and support best practices associated with the future offering of the GeoPackage file format for staged products.  

All future NHDPlus HR staged products will incorporate these changes as part of the NHDPlus HR VPU Distribution Data Model 2.01. Already published NHDPlus HR Beta staged products will not be updated. The NHDPlus HR map service will be updated to include the NHDPlus 2.31 and WBD 2.31 changes with the next update. 

What you need to know:  

  • This change will be transparent for the vast majority of NHD, NHDPlus HR, and WBD users. If the datasets are used within Esri products, everything will continue to work as before. The user will not need to do anything or update any ArcGIS or ArcGIS Pro projects, geoprocessing tools, or maps. 

  • Custom scripts (Python, R, JavaScript, etc) that reference NHD, NHDPlus HR, or WBD attribute names with the full name explicitly spelled out MAY encounter issues 

  • Example: Consider the following Python code that searches for a specific attribute within a feature class by name: 

Python code that searches for a specific attribute within a feature class by name:

Example Python code that searches for a specific attribute within a feature class by name.

With the new NHD 2.31 data model, the above code will NOT find the “permanent_identifier” attribute.  It is recommended that any code that tests attribute names test the lowercase version of the name. See the code snippet below

New code snippet for testing NHD 2.31 and WBD attribute names

Example Python code testing the lowercase version of the attribute name for the new NHD 2.31 data model.

This code would find the attribute name with the change to lower case “permanent_identifier”, but it is a best practice to always test the lower case version of text values—in this case using the Python string .lower() method (highlighted above).  

NHDPlus HR staged products will coexist with both versions of the attribute casing (new products with lowercase and older BETA products with CamelCase attribute names). If you are writing code against these datasets, it is highly recommended that you use the above best practice and test names as lower case.  

Please contact Kevin McNinch  (klmcninch@usgs.govwith any questions.