original_docstring: 
          Generates json status object from the avaialable NCEP-GFS data
          :return: json status object
          
docstring: Generates json status object from the avaialable NCEP-GFS data
docstring_tokens: Generates json status object from the avaialable NCEP - GFS data
code: def generic_status(self, table, desired_len):
          """
          Generates json status object from the avaialable NCEP-GFS data
          :return: json status object
          """
          from datetime import datetime
          db = self.connect()
  
          sql = "SELECT DISTINCT FORECASTCYCLE FROM " + table + " ORDER BY FORECASTCYCLE"
          rows = db.execute(sql).fetchall()
  
          if len(rows) < 1:
              return {
                  "min_forecast_date": None,
                  "max_forecast_date": None,
                  "first_available_cycle": None,
                  "last_available_cycle": None,
                  "latest_complete_forecast": None,
                  "latest_complete_forecast_start": None,
                  "latest_complete_forecast_end": None,
                  "latest_complete_forecast_length": None
              }
  
          cyc_min = rows[0][0]
          if len(rows) > 1:
              cyc_max = rows[-1][0]
          else:
              cyc_max = cyc_min
          latest_complete = None
          latest_start = None
          latest_end = None
          latest_length = None
          cycle_list = []
          for r in reversed(rows):
              sql = "SELECT MIN(DATE) AS FIRST, MAX(DATE) AS LAST FROM " + table + " WHERE FORECASTCYCLE = datetime('" + \
                    r[0] + "')"
              rr = db.execute(sql).fetchall()
              start = datetime.strptime(rr[0][0], "%Y-%m-%d %H:%M:%S")
              end = datetime.strptime(rr[0][1], "%Y-%m-%d %H:%M:%S")
              avail_len = (end - start).total_seconds() / 3600
              if avail_len >= desired_len:
                  latest_complete = r[0]
                  cycle_list.append(r[0])
                  latest_start = start.strftime("%Y-%m-%d %H:%M:%S")
                  latest_end = end.strftime("%Y-%m-%d %H:%M:%S")
                  latest_length = avail_len
                  break
  
          sql = "SELECT MIN(DATE) AS FIRST, MAX(DATE) AS LAST FROM " + table
          rows = db.execute(sql).fetchall()
          fcst_min = rows[0][0]
          fcst_max = rows[0][1]
  
          return {
              "min_forecast_date": fcst_min,
              "max_forecast_date": fcst_max,
              "first_available_cycle": cyc_min,
              "last_available_cycle": cyc_max,
              "latest_complete_forecast": latest_complete,
              "latest_complete_forecast_start": latest_start,
              "latest_complete_forecast_end": latest_end,
              "latest_complete_forecast_length": latest_length,
              "cycle_list": cycle_list
          }
code_tokens: def generic_status ( self , table , desired_len ) : from datetime import datetime db = self . connect ( ) sql = "SELECT DISTINCT FORECASTCYCLE FROM " + table + " ORDER BY FORECASTCYCLE" rows = db . execute ( sql ) . fetchall ( ) if len ( rows ) < 1 : return { "min_forecast_date" : None , "max_forecast_date" : None , "first_available_cycle" : None , "last_available_cycle" : None , "latest_complete_forecast" : None , "latest_complete_forecast_start" : None , "latest_complete_forecast_end" : None , "latest_complete_forecast_length" : None } cyc_min = rows [ 0 ] [ 0 ] if len ( rows ) > 1 : cyc_max = rows [ - 1 ] [ 0 ] else : cyc_max = cyc_min latest_complete = None latest_start = None latest_end = None latest_length = None cycle_list = [ ] for r in reversed ( rows ) : sql = "SELECT MIN(DATE) AS FIRST, MAX(DATE) AS LAST FROM " + table + " WHERE FORECASTCYCLE = datetime('" + r [ 0 ] + "')" rr = db . execute ( sql ) . fetchall ( ) start = datetime . strptime ( rr [ 0 ] [ 0 ] , "%Y-%m-%d %H:%M:%S" ) end = datetime . strptime ( rr [ 0 ] [ 1 ] , "%Y-%m-%d %H:%M:%S" ) avail_len = ( end - start ) . total_seconds ( ) / 3600 if avail_len >= desired_len : latest_complete = r [ 0 ] cycle_list . append ( r [ 0 ] ) latest_start = start . strftime ( "%Y-%m-%d %H:%M:%S" ) latest_end = end . strftime ( "%Y-%m-%d %H:%M:%S" ) latest_length = avail_len break sql = "SELECT MIN(DATE) AS FIRST, MAX(DATE) AS LAST FROM " + table rows = db . execute ( sql ) . fetchall ( ) fcst_min = rows [ 0 ] [ 0 ] fcst_max = rows [ 0 ] [ 1 ] return { "min_forecast_date" : fcst_min , "max_forecast_date" : fcst_max , "first_available_cycle" : cyc_min , "last_available_cycle" : cyc_max , "latest_complete_forecast" : latest_complete , "latest_complete_forecast_start" : latest_start , "latest_complete_forecast_end" : latest_end , "latest_complete_forecast_length" : latest_length , "cycle_list" : cycle_list }
short_docstring: Generates json status object from the avaialable NCEP-GFS data
short_docstring_tokens: Generates json status object from the avaialable NCEP - GFS data
comment: """
          Generates json status object from the avaialable NCEP-GFS data
          :return: json status object
          """