GeoEco.DataProducts.NOAA.ClimateIndices.PSLClimateIndices.StringsToList

classmethod PSLClimateIndices.StringsToList(strings, setNoDataValuesToNone=True)

Returns a table of climate index values parsed from a list of strings, where each string is the data for a single climate index in NOAA PSL time series format.

Parameters:
  • strings (list of str) –

    List of one or more multi-line strings in the PSL time series format documented at https://psl.noaa.gov/data/climateindices/list/:

    year1 yearN
    year1 janval febval marval aprval mayval junval julval augval sepval octval decval
    year2 janval febval marval aprval mayval junval julval augval sepval octval decval
    ...
    yearN janval febval marval aprval mayval junval julval augval sepval octval decval
    missing_value
    

    For example, the North Atlantic Oscillation (NAO), available at https://psl.noaa.gov/data/correlation/nao.data, looked like this (circa 2007):

    1948 2007
    1948 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90
    1949 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90 -99.90
    1950   0.92   0.40  -0.36   0.73  -0.59  -0.06  -1.26  -0.05   0.25   0.85  -1.26  -1.02
    1951   0.08   0.70  -1.02  -0.22  -0.59  -1.64   1.37  -0.22  -1.36   1.87  -0.39   1.32
    <Lines deleted for brevity>
    2007   0.22  -0.47   1.44   0.17   0.66  -1.31  -0.58  -0.14   0.72 -99.90 -99.90 -99.90
      -99.9
     NAO Index from CPC
    https://psl.noaa.gov/data/climateindices/list/ for info
    

    You should provide the entire text above as one string in the input list, the entire text for a different climate index as the second string, and so on.

    Any lines following missing_value are treated as comments. Minimum length꞉ 1.

  • setNoDataValuesToNone (bool, optional) – If True, the returned table will contain a None wherever the original data has a missing_value. If False, the table will contain the missing_value as it appears in the original data.

Returns:

1. list of list of object: Table of index values parsed from the input data, represented as a list of lists. The outer list contains the rows of the table. Each inner list contains the field values for a row.

There are at least two fields:

  • Date - the date of the first day of the month and year of the climate index value (e.g. 1-March-1960), as a datetime.

  • Value - the index value of the first climate index in the input data, as a float. This value may be None rather than the missing_value if setNoDataValuesToNone is True.

There will be one Value field for each climate index that you provide as input. For example, if you provide three climate indices, a table with four fields will be returned:

[[datetime.datetime(1948, 1, 1, 0, 0), 2.5, None, 1.0],
 [datetime.datetime(1948, 2, 1, 0, 0), 1.5, None, -2.0],
 [datetime.datetime(1948, 3, 1, 0, 0), 2.75, -8.0, 3.0],
 ...]

The rows will be ordered in ascending date order and all 12 months will be included for every year. If these months occur in the future they will have the missing_value (or None). If the occur prior to the first month for which data are available, as shown in the example above for the second climate index, they will also have the missing_value (or None).

2. list of float: List of values that mean “no data is available” in the value fields of the returned table. Each item in this list corresponds to one of the climate indices you provide as input. If setNoDataValuesToNone is False, the list items will be the missing_values parsed from the input data. If True, the list items will all be None.

3. list of str: List of comments parsed from the input data. Each item in this list corresponds to one of the climate indices you provide as input. If no comment was present in the input data for an index, an empty string will be stored for it in the list.

Return type:

tuple of 3 items