Thanks man... Jezuz i forgot to add per_hour :p
Le mardi 20 juin 2023 à 07:00:25 UTC+2, Rainer Lang a écrit : > > in your field map, try to put > rainRate = rainRate, mm_per_hour > # instead of rainRate = rainRate, mm > > and make sure in your weewx.conf under > [StdReport] > [[Defaults]] > [[[units]]] > [[[[groups]]]] > # you have defined > group_rainrate = mm_per_hour > > On 20.06.2023 05:41, Joao Pedro wrote: > > Hii guys :) > > Weewx : 4.10.2 > > I try to use wee_import but i've a little problem: > > "pi@raspberrypi:~ $ wee_import --import-config=/home/pi/csv.conf --dry-run > Using WeeWX configuration file /etc/weewx/weewx.conf > Starting wee_import... > A CSV import from source file '/home/pi/weewx.csv' has been requested. > Using database binding 'wx_binding', which is bound to database 'weewx' > Destination table 'archive' unit system is '0x10' (METRIC). > Missing derived observations will be calculated. > All WeeWX UV fields will be set to None. > All WeeWX radiation fields will be set to None. > This is a dry run, imported data will not be saved to archive. > Starting dry run import ... > Traceback (most recent call last): > File "/usr/share/weewx/wee_import", line 900, in <module> > main() > File "/usr/share/weewx/wee_import", line 830, in main > source_obj.run() > File "/usr/share/weewx/weeimport/weeimport.py", line 421, in run > _mapped_data = self.mapRawData(_raw_data, self.archive_unit_sys) > File "/usr/share/weewx/weeimport/weeimport.py", line 982, in mapRawData > _conv_vt = convertStd(_vt, unit_sys) > File "/usr/share/weewx/weewx/units.py", line 1489, in convertStd > return StdUnitConverters[target_std_unit_system].convert(val_t) > File "/usr/share/weewx/weewx/units.py", line 919, in convert > new_val_t = convert(val_t, new_unit_type) > File "/usr/share/weewx/weewx/units.py", line 1454, in convert > conversion_func = conversionDict[val_t[1]][target_unit] > KeyError: 'cm_per_hour'" > > > > My csv config > > # EXAMPLE CONFIGURATION FILE FOR IMPORTING FROM CSV FILES > # > # Copyright (c) 2009-2019 Tom Keffer <[email protected]> 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 > # Format is: > # source = (CSV | WU | Cumulus) > 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 = /home/pi/weewx.csv > > # The character used to separate fields. Format is: > # delimiter = <single character> > # Default is , (comma). > delimiter = ; > > # 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 the imported > records > # are equally spaced in time and there are no missing > 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 using the same archive interval as set in > weewx.conf on > # this machine. > # x - Use a fixed interval of x minutes for every record. This > # setting is best used if the records to be imported are > # equally based in time but there are some missing records. > # > # Note: If there is a mapped interval field then this setting will be > # ignored. > # Format is: > # interval = (derive | conf | x) > interval = conf > > # 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) > 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) > calc_missing = True > > # 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 > tranche = 250 > > # Specify whether a UV sensor was used to produce any UV observations. > # 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 fields 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) > UV_sensor = False > > # Specify whether a solar radiation sensor was used to produce any > solar > # radiation observations. 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 fields 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) > solar_sensor = False > > # Date-time format of CSV field from which the WeeWX archive record > # dateTime field is to be extracted. wee_import first attempts to > interpret > # date/time info in this format, if this fails it then attempts to > # interpret it as a timestamp and if this fails it then raises an > error. > # Uses Python strptime() format codes. > # raw_datetime_format = Python strptime() format string > raw_datetime_format = %d/%m/%Y %H:%M > > # Does the imported rain field represent the total rainfall since the > last > # record or a cumulative value. Available options are: > # discrete - rain field represents total rainfall since last record > # cumulative - rain field represents a cumulative rainfall reset at > # midnight > # rain = (discrete | cumulative) > rain = discrete > > # 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 is: > # > # weewx_archive_field_name = csv_field_name, weewx_unit_name > # > # where: > # weewx_archive_field_name - An observation name in the WeeWX > database > # schema. > # csv_field_name - The name of a field from the CSV file. > # weewx_unit_name - The name of the units, as defined in > WeeWX, > # used by csv_field_name. wee_import will > do > # the necessary conversions to the unit > system > # used by the WeeWX archive. > # For example, > # outTemp = Temp, degree_C > # would map the CSV field Temp, in degrees C, to the 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 = csv_date_and_time, 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. > # > # Field mapping to the WeeWX usUnits archive field is currently not > # supported. If a usUnits field exists in the CSV data it should not be > # mapped, rather WeeWX unit names should included against each field > to be > # imported in the field map. > # > # 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 = dateTime, unix_epoch > rainRate = rainRate, mm > rain = rain, mm > > > My csv file > > dateTime;rainRate;rain > > 17/06/2023 00:05;0.0;0.0 > > 17/06/2023 00:20;0.0;0.0 > > 17/06/2023 00:35;0.0;0.0 > > 17/06/2023 00:50;0.0;0.0 > > 17/06/2023 01:05;0.0;0.0 > > 17/06/2023 01:20;0.0;0.0 > > 17/06/2023 01:35;0.0;0.0 > > 17/06/2023 01:50;0.0;0.0 > > 17/06/2023 02:05;0.0;0.0 > > 17/06/2023 02:20;0.0;0.0 > > 17/06/2023 02:35;0.0;0.0 > > 17/06/2023 02:50;0.0;0.0 > > 17/06/2023 03:05;0.0;0.0 > > 17/06/2023 03:20;0.0;0.0 > > 17/06/2023 03:35;0.0;0.0 > > 17/06/2023 03:50;0.0;0.0 > > 17/06/2023 04:05;0.0;0.0 > > 17/06/2023 04:20;0.0;0.0 > > 17/06/2023 04:35;0.0;0.0 > > 17/06/2023 04:50;0.0;0.0 > > 17/06/2023 05:05;0.0;0.0 > > 17/06/2023 05:20;0.0;0.0 > > 17/06/2023 05:35;0.0;0.0 > > 17/06/2023 05:50;0.0;0.0 > > 17/06/2023 06:05;0.0;0.0 > > 17/06/2023 06:20;0.0;0.0 > > 17/06/2023 06:35;0.0;0.0 > > 17/06/2023 06:50;0.0;0.0 > > 17/06/2023 07:05;0.0;0.0 > > 17/06/2023 07:20;0.0;0.0 > > 17/06/2023 07:35;0.0;0.0 > > 17/06/2023 07:50;0.0;0.0 > > 17/06/2023 08:05;0.0;0.0 > > 17/06/2023 08:20;0.0;0.0 > > 17/06/2023 08:35;0.0;0.0 > > 17/06/2023 08:50;0.0;0.0 > > 17/06/2023 09:05;0.0;0.0 > > 17/06/2023 09:20;0.0;0.0 > > 17/06/2023 09:35;0.0;0.0 > > 17/06/2023 09:50;0.0;0.0 > > 17/06/2023 10:05;0.0;0.0 > > 17/06/2023 10:20;0.0;0.0 > > 17/06/2023 10:35;0.0;0.0 > > 17/06/2023 10:50;0.0;0.0 > > 17/06/2023 11:05;0.0;0.0 > > 17/06/2023 11:20;0.0;0.0 > > 17/06/2023 11:35;0.0;0.0 > > 17/06/2023 11:50;0.0;0.0 > > 17/06/2023 12:05;0.0;0.0 > > 17/06/2023 12:20;0.0;0.0 > > 17/06/2023 12:35;0.0;0.0 > > 17/06/2023 12:50;0.0;0.0 > > 17/06/2023 13:05;0.0;0.0 > > 17/06/2023 13:20;0.0;0.0 > > 17/06/2023 13:35;0.0;0.0 > > 17/06/2023 13:50;0.0;0.0 > > 17/06/2023 14:05;0.0;0.0 > > 17/06/2023 14:20;0.0;0.0 > > 17/06/2023 14:35;0.0;0.0 > > 17/06/2023 14:50;0.0;0.0 > > 17/06/2023 15:05;0.0;0.0 > > 17/06/2023 15:20;0.0;0.0 > > 17/06/2023 15:35;0.0;0.0 > > 17/06/2023 15:50;0.0;0.0 > > 17/06/2023 16:05;0.0;0.0 > > 17/06/2023 16:20;0.0;0.0 > > 17/06/2023 16:35;0.0;0.0 > > 17/06/2023 16:50;0.0;0.0 > > 17/06/2023 17:05;0.0;0.0 > > 17/06/2023 17:20;0.0;0.0 > > 17/06/2023 17:35;0.0;0.0 > > 17/06/2023 17:50;0.0;0.0 > > 17/06/2023 18:05;0.0;0.0 > > 17/06/2023 18:20;0.0;0.0 > > 17/06/2023 18:35;0.0;0.0 > > 17/06/2023 18:50;0.0;0.0 > > 17/06/2023 19:05;0.0;0.0 > > 17/06/2023 19:20;0.0;0.0 > > 17/06/2023 19:35;3.8;0.4 > > 17/06/2023 19:50;19.2;6.0 > > 17/06/2023 20:05;3.2;2.0 > > 17/06/2023 20:20;3.0;1.2 > > 17/06/2023 20:35;2.2;0.4 > > 17/06/2023 20:50;4.8;1.2 > > 17/06/2023 21:05;2.4;0.8 > > 17/06/2023 21:20;1.8;0.4 > > 17/06/2023 21:35;0.8;0.0 > > 17/06/2023 21:50;0.2;0.2 > > 17/06/2023 22:05;0.2;0.0 > > 17/06/2023 22:20;0.0;0.0 > > 17/06/2023 22:35;0.0;0.0 > > 17/06/2023 22:50;0.0;0.0 > > 17/06/2023 23:05;0.0;0.0 > > 17/06/2023 23:20;0.0;0.0 > > 17/06/2023 23:35;0.0;0.0 > > 17/06/2023 23:50;0.0;0.0 > > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/5a1bc216-a95a-43b3-9abe-f988d0cd084bn%40googlegroups.com > > <https://groups.google.com/d/msgid/weewx-user/5a1bc216-a95a-43b3-9abe-f988d0cd084bn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/b119eb8b-e850-427a-b94a-1abd7d867590n%40googlegroups.com.
