#C13019. Weather Data Analysis

    ID: 42511 Type: Default 1000ms 256MiB

Weather Data Analysis

Weather Data Analysis

You are given weather data in CSV format through standard input. The first line is the header which contains the following fields: Date, Temperature, Wind Speed, and Precipitation. Each subsequent line contains a record with these values. You are required to compute the following:

  • The average temperature of all valid records.
  • The average wind speed of all valid records.
  • The date with the highest recorded temperature.
  • The count of days where the precipitation exceeds 0.1 inches.

If a record contains invalid data (i.e. numeric fields cannot be converted properly), print an error message in the format Data format error: <error message> and skip that record. All averages must be printed with exactly two decimal places. The date output should be in the format YYYY-MM-DD (or N/A if no valid record is found for temperature).

Note: The input is read from standard input and the output should be printed to standard output.

inputFormat

The input is provided via standard input (stdin) and has the following format:

Date,Temperature,Wind Speed,Precipitation
2023-01-01,30.0,5.0,0.2
2023-01-02,25.0,6.0,0.0
...

The first line is the header. Each subsequent line is a CSV record.

outputFormat

The program must print exactly four lines to standard output (stdout):

  1. Average Temperature: (average temperature formatted to two decimals)
  2. Average Wind Speed: (average wind speed formatted to two decimals)
  3. Date with Highest Temperature: (date in YYYY-MM-DD format or N/A)
  4. Days with Precipitation > 0.1 inches: (number of days)

Any error messages (due to invalid data) should also be printed in the order they occur.

## sample
Date,Temperature,Wind Speed,Precipitation
2023-01-01,30.0,5.0,0.2
2023-01-02,25.0,6.0,0.0
2023-01-03,35.0,4.0,0.15
2023-01-04,33.0,3.0,0.0
Average Temperature: 30.75

Average Wind Speed: 4.50 Date with Highest Temperature: 2023-01-03 Days with Precipitation > 0.1 inches: 2

</p>