I'm trying to track the water level of a lake so I added a new column to 
the database (lakeSurfaceLevel), created a service to populate the data, 
and modified my skin to display it. All of that works great, however when I 
try to import data for that new observation using weectl, I get a error 
"KeyError: 'lakeSurfaceLevel'

Any help would be greatly appreciated!

Attached are the csv.conf and a data file

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/83ca580f-584e-462a-8b00-8c8d0addfd50n%40googlegroups.com.
datetime,lakeSurfaceLevel
2024-07-09 0:00:00,321.83
2024-07-09 0:15:00,321.83
2024-07-09 0:30:00,321.82
2024-07-09 0:45:00,321.82
2024-07-09 1:00:00,321.82
2024-07-09 1:15:00,321.82
2024-07-09 1:30:00,321.81
2024-07-09 1:45:00,321.81
2024-07-09 2:00:00,321.81
2024-07-09 2:15:00,321.81
2024-07-09 2:30:00,321.81
2024-07-09 2:45:00,321.81
2024-07-09 3:00:00,321.81
2024-07-09 3:15:00,321.80
2024-07-09 3:30:00,321.80
2024-07-09 3:45:00,321.80
2024-07-09 4:00:00,321.80
2024-07-09 4:15:00,321.80
2024-07-09 4:30:00,321.80
2024-07-09 4:45:00,321.80
2024-07-09 5:00:00,321.80
2024-07-09 5:15:00,321.80
2024-07-09 5:30:00,321.80
2024-07-09 5:45:00,321.80
2024-07-09 6:00:00,321.80
2024-07-09 6:15:00,321.80
2024-07-09 6:30:00,321.80
2024-07-09 6:45:00,321.80
2024-07-09 7:00:00,321.80
2024-07-09 7:15:00,321.80
2024-07-09 7:30:00,321.80
2024-07-09 7:45:00,321.79
# EXAMPLE CONFIGURATION FILE FOR IMPORTING FROM CSV FILES
#
# Copyright (c) 2009-2024 Tom Keffer <tkef...@gmail.com> and Gary Roderick.
# See the file LICENSE.txt for your rights.

##############################################################################

# Specify the source. Available options are:
#   CSV - import obs from a single CSV format file
#   WU - import obs from a Weather Underground PWS history
#   Cumulus - import obs from a one or more Cumulus monthly log files
#   WD - import obs from a one or more WD monthly log files
#   WeatherCat - import obs from a one or more WeatherCat monthly .cat files
# Format is:
#   source = (CSV | WU | Cumulus | WD | WeatherCat)
source = CSV

##############################################################################

[CSV]
    # Parameters used when importing from a CSV file

    # Path and name of our CSV source file. Format is:
    #   file = full path and filename
    file = /Users/zach/Downloads/Untitled.csv

    # Specify the character used to separate fields. The character must be
    # enclosed in quotes. Format is:
    #   delimiter = '<single character>'
    # Default is ',' (comma).
    delimiter = ','
    
    # Specify the character used as the decimal point. The character must be
    # enclosed in quotes.
    # Format is:
    #   decimal = '<single character>'
    #   or
    # Default is '.' (period).
    decimal = '.'

    # If there is no mapped interval field how will the interval field be
    # determined for the imported records. Available options are:
    #   derive - Derive the interval field from the timestamp of successive
    #            records. This setting is best used when there are no missing
    #            records from period being imported. Missing records will cause
    #            the interval field to be incorrectly calculated for some
    #            records.
    #   conf   - Use the interval setting from weewx.conf. This setting is best
    #            used if the records to be imported have been produced by WeeWX
    #            or some other means with the same archive interval as set in
    #            weewx.conf on this machine.
    #   x      - Use a fixed interval of 'x' minutes for every record where 'x'
    #            is a number. This setting is best used if the records to be
    #            imported are equally spaced in time but there are some missing
    #            records.
    #
    # Note: If there is a mapped interval field this setting will be ignored.
    # Format is:
    #   interval = (derive | conf | x)
    # Default is derive.
    interval = derive

    # Should the [StdQC] max/min limits in weewx.conf be applied to the
    # imported data. This may be useful if the source has extreme values that
    # are clearly incorrect for some observations. Available options are:
    #   True  - weewx.conf [StdQC] max/min limits are applied.
    #   False - weewx.conf [StdQC] max/min limits are not applied.
    # Format is:
    #   qc = (True | False)
    # Default is True.
    qc = True

    # Should any missing derived observations be calculated from the imported
    # data if possible. Available options are:
    #   True  - Any missing derived observations are calculated.
    #   False - Any missing derived observations are not calculated.
    # Format is:
    #   calc_missing = (True | False)
    # Default is True.
    calc_missing = False

    # Specify how imported data fields that contain invalid data (eg a numeric
    # field containing non-numeric data) are handled. Available options are:
    #   True  - The invalid data is ignored, the WeeWX target field is set to
    #           None and the import continues.
    #   False - The import is halted.
    # Format is:
    #   ignore_invalid_data = (True | False)
    # Default is True.
    ignore_invalid_data = True

    # Imported records are written to archive in transactions of 'tranche'
    # records at a time. Increase for faster throughput, decrease to reduce
    # memory requirements. Format is:
    #   tranche = x
    # where x is an integer
    # Default is 250.
    tranche = 250

    # Specify whether a UV sensor was used to produce UV observation data.
    # Available options are:
    #   True  - UV sensor was used and UV data will be imported.
    #   False - UV sensor was not used and any UV data will not be imported.
    #           UV field will be set to None/NULL.
    # For a CSV import UV_sensor should be set to False if a UV sensor was
    # NOT present when the import data was created. Otherwise it may be set to
    # True or omitted. Format is:
    #   UV_sensor = (True | False)
    # Default is True.
    UV_sensor = False

    # Specify whether a solar radiation sensor was used to produce solar
    # radiation observation data. Available options are:
    #   True  - Solar radiation sensor was used and solar radiation data will
    #           be imported.
    #   False - Solar radiation sensor was not used and any solar radiation
    #           data will not be imported. radiation field will be set to
    #           None/NULL.
    # For a CSV import solar_sensor should be set to False if a solar radiation
    # sensor was NOT present when the import data was created. Otherwise it may
    # be set to True or omitted. Format is:
    #   solar_sensor = (True | False)
    # Default is True.
    solar_sensor = False

    # Date-time format of CSV field from which the WeeWX archive record
    # dateTime field is to be extracted. The import utility first attempts to
    # interpret date-time data in this format, if this fails it then attempts
    # to interpret it as a timestamp and if this fails an error is raised. Uses
    # Python strptime() format codes. Format is:
    #   raw_datetime_format = Python strptime() format string
    raw_datetime_format = %Y-%m-%d %H:%M:%S

    # Lower and upper bounds for imported wind direction. It is possible,
    # particularly for a calculated direction, to have a value (eg -45) outside
    # of the WeeWX limits (0 to 360 inclusive). Format is:
    #
    # wind_direction = lower,upper
    #
    # where :
    #   lower is the lower limit of acceptable wind direction in degrees
    #   (may be negative)
    #   upper is the upper limit of acceptable wind direction in degrees
    #
    # Imported values from lower to upper will be normalised to the range 0 to
    # 360. Values outside of the parameter range will be stored as None.
    # Default is -360,360.
    wind_direction = -360,360

    # Map CSV record fields to WeeWX archive fields. Format for each map entry
    # is:
    #
    #   [[[weewx_archive_field_name]]]
    #       source_field = csv_field_name
    #       unit = weewx_unit_name
    #       is_cumulative = True | False
    #       is_text = True | False
    #
    # where:
    #   weewx_archive_field_name - An observation name in the WeeWX database
    #                              schema.
    #   source_field             - Config option specifying the CSV field being
    #                              mapped.
    #   csv_field_name           - The name of a field from the CSV file.
    #   unit                     - Config option specifying the unit used by
    #                              the CSV field being mapped.
    #   weewx_unit_name          - The WeeWX unit name for the the units used
    #                              by csv_field_name.
    #   is_cumulative            - Config option specifying whether the CSV
    #                              field being mapped is cumulative,
    #                              e.g: dayrain. Optional, default value is
    #                              False.
    #   is_text                  - Config option specifying whether the CSV
    #                              field being mapped is text. Optional,
    #                              default value is False.
    # For example,
    #   [[[outTemp]]]
    #       source_field = Temp
    #       unit = degree_C
    # would map the CSV field 'Temp', in degrees C, to the WeeWX archive field
    # 'outTemp'.
    #
    # A mapping for WeeWX field 'dateTime' is mandatory and the WeeWX unit name
    # for the 'dateTime' mapping must be 'unix_epoch'. For example,
    #   [[[dateTime]]]
    #       source_field = csv_date_and_time
    #       unit = unix_epoch
    # would map the CSV field 'csv_date_and_time' to the WeeWX 'dateTime' field
    # with the 'csv_date_and_time' field being interpreted first using the
    # format specified at the 'raw_datetime_format' config option and if that
    # fails as a unix epoch timestamp.
    #
    # If the CSV data contains a field with WeeWX 'usUnits' data the field may
    # be mapped to WeeWX field 'usUnits' and this value will be used to
    # determine the units used for each CSV field. If a 'usUnits' mapping is
    # included the 'unit' option may be omitted as the 'usUnits' value is
    # unitless. If the 'unit' option is set it will be ignored. If a 'usUnits'
    # mapping is included the 'unit' option for all other fields may be
    # omitted.
    #
    # WeeWX archive fields that do not exist in the CSV data may be omitted.
    # Any omitted fields that are derived (eg 'dewpoint') may be calculated
    # during import using the equivalent of the WeeWX StdWXCalculate service
    # through setting the 'calc-missing' parameter above.
    [[FieldMap]]
        [[[dateTime]]]
            source_field = datetime
            unit = unix_epoch
        [[[lakeSurfaceLevel]]]
            source_field = lakeSurfaceLevel
            unit = foot

Reply via email to