案例:案例python编程案例IT案例计算机案例英文案例
当前位置:以往案例 > >案例:案例python编程案例IT案例计算机案例英文案例
2018-02-25

Python ProgrammingDesign a solution and implement the solution in Python to solve the problem described below.

Historical data for solar radiation and wind speeds is available (along with other sensor information) in the files that you have been given. Data is logged at intervals of 10 minutes. Each file contains a year’s worth of data for multiple sensors. Data for each date-time recording are on separate rows. Within each row, the value for each sensor is separated by a comma. The sensor codes are shown below.

You have a client who is interested in a program which can give the following answers. You should provide a suitable menu with an exit option in your main program. When designing the output, imagine yourself as the user of the program. You want the user interaction to be user friendly on the command line. Do not use GUI interaction.

1. The maximum wind speed for a specified month and year. (print on screen only)

2. Average wind speed for each month of a specified year. (print on screen only)

3. Total solar radiation in kWh/m2 for each month of a specified year. (print on screen only)

4. Average wind speed km/h and total solar radiation in kWh/m2 for each month of a specified year. (write to a file called “WindandSolar.csv”)

Format: Year,Month,Wind Speed,Solar Radiation

Example format is:

1905 January,5.5,196.4 February,4.5,200.3

Year is specified on the first line and the subsequent lines list the month and the average wind speed and the total solar radiation for each month. The values are comma separated.

If data is not available for any month, do not output the month for menu item 4. If the entire year’s data is not available, output just the year but no monthly data. For menu items 1 – 3, output a suitable message indicating what data is not available.

5. Given a Date in the form dd/mm/yyyy, show the times for the highest solar radiation for that Date. Output to screen using this sample format: (There will be one or more time values that are output.)

Date: 11/1/2019

High solar radiation for the day: 1046 W/m2

Time:

10::40

11:30

6. Exit the program.

The date, month and/or year are specified by the user. Your program asks for these on the command line and the user types in the required values and presses the “Enter” key.

Processing:

Your program must first load the data from multiple files. After loading the data, a menu is displayed to the user.

Sensor Codes

T Ambient Air Temperature 1m

DP Dew Point Temperture

BP Barometric Pressure (Instrument)

QFE Barometric Pressure (QFE Station Elevation)

QFF Barometric Pressure (QFF Mean Sea Level)

QNH Barometric Pressure (QNH Aviation Standard)

RF10 Rainfall (10min)

RF Rainfall (Accumulated)

EV10 Evaporation (10min)

EV Evaporation (Accumulated)

RH Relative Humidity

S Wind Speed (10min Mean) 10m

Dta Wind Direction (10min Mean) 10m

Sx Wind Gust Speed 10m

Dtx Wind Gust Direction 10m

Ss Wind Speed (10min SD) 10m

Dts Wind Direction (10min SD) 10m

Ws Wind Speed 10m

Wd Wind Direction 10m

SR Solar Radiation (10min Avg)

T10 Soil Temperature (Depth 10cm)

T20 Soil Temperature (Depth 20cm)

T30 Soil Temperature (Depth 30cm)

T40 Soil Temperature (Depth 40cm)

T50 Soil Temperature (Depth 50cm)

T60 Soil Temperature (Depth 60cm)

T70 Soil Temperature (Depth 70cm)

T80 Soil Temperature (Depth 80cm)

T90 Soil Temperature (Depth 90cm)

T100 Soil Temperature (Depth 100cm)

T110 Soil Temperature (Depth 110cm)

T120 Soil Temperature (Depth 120cm)

M10 Soil Moisture (Depth 10cm)

M20 Soil Moisture (Depth 20cm)

M30 Soil Moisture (Depth 30cm)

M40 Soil Moisture (Depth 40cm)

M50 Soil Moisture (Depth 50cm)

M60 Soil Moisture (Depth 60cm)

M70 Soil Moisture (Depth 70cm)

M80 Soil Moisture (Depth 80cm)

M90 Soil Moisture (Depth 90cm)

M100 Soil Moisture (Depth 100cm)

M110 Soil Moisture (Depth 110cm)

M120 Soil Moisture (Depth 120cm)


在线提交订单