docs: def identify_lsm_grid(lsm_grid_path):
      """
      This is used to idenfity the input LSM grid
      """
      # check to see what kind of file we are dealing with
      lsm_example_file = Dataset(lsm_grid_path)
  
      # INDENTIFY LAT/LON DIMENSIONS
      dim_list = lsm_example_file.dimensions.keys()
  
      latitude_dim = "lat"
      if 'latitude' in dim_list:
          latitude_dim = 'latitude'
      elif 'g0_lat_0' in dim_list:
          # GLDAS/NLDAS MOSAIC
          latitude_dim = 'g0_lat_0'
      elif 'lat_110' in dim_list:
          # NLDAS NOAH/VIC
          latitude_dim = 'lat_110'
      elif 'north_south' in dim_list:
          # LIS/Joules
          latitude_dim = 'north_south'
      elif 'south_north' in dim_list:
          # WRF Hydro
          latitude_dim = 'south_north'
      elif 'Y' in dim_list:
          # FLDAS
          latitude_dim = 'Y'
  
      longitude_dim = "lon"
      if 'longitude' in dim_list:
          longitude_dim = 'longitude'
      elif 'g0_lon_1' in dim_list:
          # GLDAS/NLDAS MOSAIC
          longitude_dim = 'g0_lon_1'
      elif 'lon_110' in dim_list:
          # NLDAS NOAH/VIC
          longitude_dim = 'lon_110'
      elif 'east_west' in dim_list:
          # LIS/Joules
          longitude_dim = 'east_west'
      elif 'west_east' in dim_list:
          # WRF Hydro
          longitude_dim = 'west_east'
      elif 'X' in dim_list:
          # FLDAS
          longitude_dim = 'X'
  
      time_dim = None
      if 'time' in dim_list:
          time_dim = 'time'
      elif 'Time' in dim_list:
          time_dim = 'Time'
      elif 'Times' in dim_list:
          time_dim = 'Times'
      elif 'times' in dim_list:
          time_dim = 'times'
  
      lat_dim_size = len(lsm_example_file.dimensions[latitude_dim])
      lon_dim_size = len(lsm_example_file.dimensions[longitude_dim])
  
      # IDENTIFY VARIABLES
      var_list = lsm_example_file.variables.keys()
  
      latitude_var = "lat"
      if 'latitude' in var_list:
          latitude_var = 'latitude'
      elif 'g0_lat_0' in var_list:
          latitude_var = 'g0_lat_0'
      elif 'lat_110' in var_list:
          latitude_var = 'lat_110'
      elif 'north_south' in var_list:
          latitude_var = 'north_south'
      elif 'XLAT' in var_list:
          # WRF
          latitude_var = 'XLAT'
      elif 'Y' in var_list:
          # FLDAS
          latitude_var = 'Y'
  
      longitude_var = "lon"
      if 'longitude' in var_list:
          longitude_var = 'longitude'
      elif 'g0_lon_1' in var_list:
          longitude_var = 'g0_lon_1'
      elif 'lon_110' in var_list:
          longitude_var = 'lon_110'
      elif 'east_west' in var_list:
          longitude_var = 'east_west'
      elif 'XLONG' in var_list:
          # WRF
          longitude_var = 'XLONG'
      elif 'X' in var_list:
          # FLDAS
          longitude_var = 'X'
  
      time_var = None
      if 'time' in var_list:
          time_var = 'time'
      elif 'Time' in var_list:
          time_var = 'Time'
      elif 'Times' in var_list:
          time_var = 'Times'
      elif 'times' in var_list:
          time_var = 'times'
  
      surface_runoff_var = ""
      subsurface_runoff_var = ""
      total_runoff_var = ""
      for var in var_list:
          if var.startswith("SSRUN"):
              # NLDAS/GLDAS
              surface_runoff_var = var
          elif var.startswith("BGRUN"):
              # NLDAS/GLDAS
              subsurface_runoff_var = var
          elif var == "Qs_acc":
              # GLDAS v2
              surface_runoff_var = var
          elif var == "Qsb_acc":
              # GLDAS v2
              subsurface_runoff_var = var
          elif var == "Qs_tavg":
              # FLDAS
              surface_runoff_var = var
          elif var == "Qsb_tavg":
              # FLDAS
              subsurface_runoff_var = var
          elif var == "Qs_inst":
              # LIS
              surface_runoff_var = var
          elif var == "Qsb_inst":
              # LIS
              subsurface_runoff_var = var
          elif var == "SFROFF":
              # WRF Hydro
              surface_runoff_var = var
          elif var == "UDROFF":
              # WRF Hydro
              subsurface_runoff_var = var
          elif var.lower() == "ro":
              # ERA Interim
              total_runoff_var = var
          elif var == "total runoff":
              # CMIP5 data
              total_runoff_var = var
  
      # IDENTIFY GRID TYPE
      lsm_file_data = {
          "weight_file_name": "",
          "grid_type": "",
          "model_name": "",
          "description": "",
          "rapid_inflow_tool": None,
          "latitude_var": latitude_var,
          "longitude_var": longitude_var,
          "time_var": time_var,
          "latitude_dim": latitude_dim,
          "longitude_dim": longitude_dim,
          "time_dim": time_dim,
      }
  
      institution = ""
      title = ""
      try:
          institution = lsm_example_file.getncattr("institution")
      except AttributeError:
          pass
      try:
          title = lsm_example_file.getncattr("title")
      except AttributeError:
          pass
  
      runoff_vars = [surface_runoff_var, subsurface_runoff_var]
  
      if institution == "European Centre for Medium-Range Weather Forecasts" \
              or total_runoff_var.lower() == "ro":
          # these are the ECMWF models
          if lat_dim_size == 361 and lon_dim_size == 720:
              print("Runoff file identified as ERA Interim Low Res (T255) GRID")
              # A) ERA Interim Low Res (T255)
              # Downloaded as 0.5 degree grid
              #  dimensions:
              # 	 longitude = 720 ;
              # 	 latitude = 361 ;
              lsm_file_data["description"] = "ERA Interim (T255 Grid)"
              lsm_file_data["model_name"] = "erai"
              lsm_file_data["weight_file_name"] = r'weight_era_t255\.csv'
              lsm_file_data["grid_type"] = 't255'
  
          elif lat_dim_size == 512 and lon_dim_size == 1024:
              print("Runoff file identified as ERA Interim High Res (T511) GRID")
              # B) ERA Interim High Res (T511)
              #  dimensions:
              #   lon = 1024 ;
              #   lat = 512 ;
              lsm_file_data["description"] = "ERA Interim (T511 Grid)"
              lsm_file_data["weight_file_name"] = r'weight_era_t511\.csv'
              lsm_file_data["model_name"] = "erai"
              lsm_file_data["grid_type"] = 't511'
          elif lat_dim_size == 161 and lon_dim_size == 320:
              print("Runoff file identified as ERA 20CM (T159) GRID")
              # C) ERA 20CM (T159) - 3hr - 10 ensembles
              # Downloaded as 1.125 degree grid
              #  dimensions:
              #   longitude = 320 ;
              #   latitude = 161 ;
              lsm_file_data["description"] = "ERA 20CM (T159 Grid)"
              lsm_file_data["weight_file_name"] = r'weight_era_t159\.csv'
              lsm_file_data["model_name"] = "era_20cm"
              lsm_file_data["grid_type"] = 't159'
          else:
              lsm_example_file.close()
              raise Exception("Unsupported ECMWF grid.")
  
          lsm_file_data["rapid_inflow_tool"] = \
              CreateInflowFileFromERAInterimRunoff()
  
      elif institution == "NASA GSFC":
          if title == "GLDAS2.0 LIS land surface model output":
              print("Runoff file identified as GLDAS v2 LIS GRID")
              # this is the LIS model
              lsm_file_data["weight_file_name"] = r'weight_gldas2\.csv'
              lsm_file_data["grid_type"] = 'gldas2'
              lsm_file_data["description"] = "GLDAS2.0 LIS"
              lsm_file_data["model_name"] = "nasa"
  
          else:
              print("Runoff file identified as LIS GRID")
              # this is the LIS model (can be FLDAS)
              # THIS CASE CAN ALSO BE FOR FLDAS, however you will need to add
              # the file_datetime_pattern && file_datetime_re_pattern for it to
              # work if it is not 3-hourly time step.
              lsm_file_data["weight_file_name"] = r'weight_lis\.csv'
              lsm_file_data["grid_type"] = 'lis'
              lsm_file_data["description"] = "NASA GSFC LIS"
              lsm_file_data["model_name"] = "nasa"
  
      elif institution == "Met Office, UK":
          print("Runoff file identified as Joules GRID")
          lsm_file_data["weight_file_name"] = r'weight_joules\.csv'
          lsm_file_data["grid_type"] = 'joules'
          lsm_file_data["description"] = "Met Office Joules"
          lsm_file_data["model_name"] = "met_office"
  
      elif institution == "NCAR, USACE, USBR":
          print("Runoff file identified as CMIP5")
          lsm_file_data["weight_file_name"] = r'weight_cmip5\.csv'
          lsm_file_data["grid_type"] = 'cmip5'
          lsm_file_data["description"] = "CMIP5 Runoff"
          lsm_file_data["model_name"] = "cmip5"
  
          runoff_vars = [total_runoff_var]
  
      elif surface_runoff_var.startswith("SSRUN") \
              and subsurface_runoff_var.startswith("BGRUN"):
  
          lsm_file_data["model_name"] = "nasa"
          if lat_dim_size == 600 and lon_dim_size == 1440:
              print("Runoff file identified as GLDAS GRID")
              # GLDAS NC FILE
              # dimensions:
              #     g0_lat_0 = 600 ;
              #     g0_lon_1 = 1440 ;
              # variables
              # SSRUN_GDS0_SFC_ave1h (surface)
              # BGRUN_GDS0_SFC_ave1h (subsurface)
              #  or
              # SSRUNsfc_GDS0_SFC_ave1h (surface)
              # BGRUNsfc_GDS0_SFC_ave1h (subsurface)
              lsm_file_data["description"] = "GLDAS"
              lsm_file_data["weight_file_name"] = r'weight_gldas\.csv'
              lsm_file_data["grid_type"] = 'gldas'
  
          elif lat_dim_size <= 224 and lon_dim_size <= 464:
              print("Runoff file identified as NLDAS GRID")
              # NLDAS MOSAIC FILE
              # dimensions:
              #     g0_lat_0 = 224 ;
              #     g0_lon_1 = 464 ;
              # NLDAS NOAH/VIC FILE
              # dimensions:
              #     lat_110 = 224 ;
              #     lon_110 = 464 ;
  
              lsm_file_data["description"] = "NLDAS"
              lsm_file_data["weight_file_name"] = r'weight_nldas\.csv'
              lsm_file_data["grid_type"] = 'nldas'
          else:
              lsm_example_file.close()
              raise Exception("Unsupported runoff grid.")
  
      else:
          title = ""
          try:
              title = lsm_example_file.getncattr("TITLE")
          except AttributeError:
              pass
  
          if "WRF" in title:
              lsm_file_data["description"] = "WRF/WRF-Hydro Runoff"
              lsm_file_data["weight_file_name"] = r'weight_wrf\.csv'
              lsm_file_data["model_name"] = 'wrf'
              lsm_file_data["grid_type"] = 'wrf'
  
              lsm_file_data['rapid_inflow_tool'] = \
                  CreateInflowFileFromWRFHydroRunoff(
                      latitude_dim,
                      longitude_dim,
                      latitude_var,
                      longitude_var,
                      surface_runoff_var,
                      subsurface_runoff_var,
                  )
          else:
              lsm_example_file.close()
              raise Exception("Unsupported LSM grid.")
  
      lsm_example_file.close()
  
      # set the inflow tool to use the LDAS tool by default
      if lsm_file_data["rapid_inflow_tool"] is None:
          lsm_file_data["rapid_inflow_tool"] = \
              CreateInflowFileFromLDASRunoff(
                  latitude_dim,
                  longitude_dim,
                  latitude_var,
                  longitude_var,
                  runoff_vars,
              )
  
      return lsm_file_data