docs: def _write_lat_lon(data_out_nc, rivid_lat_lon_z_file):
          """Add latitude and longitude each netCDF feature
          Lookup table is a CSV file with rivid, Lat, Lon, columns.
          Columns must be in that order and these must be the first
          three columns.
          """
          # only add if user adds
          if rivid_lat_lon_z_file and os.path.exists(rivid_lat_lon_z_file):
              # get list of COMIDS
              lookup_table = np.loadtxt(
                  rivid_lat_lon_z_file,
                  delimiter=",",
                  usecols=(0, 1, 2),
                  skiprows=1,
                  dtype={
                      'names': ('rivid', 'lat', 'lon'),
                      'formats': ('i8', 'f8', 'f8'),
                  },
              )
  
              # Get relevant arrays while we update them
              nc_rivids = data_out_nc.variables['rivid'][:]
              lats = data_out_nc.variables['lat'][:]
              lons = data_out_nc.variables['lon'][:]
  
              lat_min = None
              lat_max = None
              lon_min = None
              lon_max = None
  
              # Process each row in the lookup table
              for nc_index, nc_rivid in enumerate(nc_rivids):
                  try:
                      lookup_index = \
                          np.where(lookup_table['rivid'] == nc_rivid)[0][0]
                  except Exception:
                      raise Exception('rivid {0} misssing in '
                                      'comid_lat_lon_z file'.format(nc_rivid))
  
                  lat = float(lookup_table['lat'][lookup_index])
                  lats[nc_index] = lat
                  if lat_min is None or lat < lat_min:
                      lat_min = lat
                  if lat_max is None or lat > lat_max:
                      lat_max = lat
  
                  lon = float(lookup_table['lon'][lookup_index])
                  lons[nc_index] = lon
                  if lon_min is None or lon < lon_min:
                      lon_min = lon
                  if lon_max is None or lon > lon_max:
                      lon_max = lon
  
              # Overwrite netCDF variable values
              data_out_nc.variables['lat'][:] = lats
              data_out_nc.variables['lon'][:] = lons
  
              # Update metadata
              if lat_min is not None:
                  data_out_nc.geospatial_lat_min = lat_min
              if lat_max is not None:
                  data_out_nc.geospatial_lat_max = lat_max
              if lon_min is not None:
                  data_out_nc.geospatial_lon_min = lon_min
              if lon_max is not None:
                  data_out_nc.geospatial_lon_max = lon_max
          else:
              print('No comid_lat_lon_z file. Not adding values ...')