station_simulator/cli.py
def generate_csv(output, station_name, start_date, end_date, frequency):
    '''
    Writes a bunch of random data to output

    :param str output: Path to file to write
    :param str station_name: Name of the station as it should appear in CSV file
    :param datetime start_date: Start Date
    :param datetime end_date: End Date
    :param str frequency: Frequency of observations
    '''
    current_date = start_date
    with open(output, 'w') as csvfile:
        csv_writer = csv.writer(csvfile)
        csv_writer.writerow(['Station', 'Date/Time', 'Conductivity (S/m-1)',
                             'Temperature (deg_C)', 'Pressure (mbar)'])

        while current_date < end_date:
            row = generate_row(station_name, current_date)
            csv_writer.writerow(row)

            if frequency == 'hour':
                current_date += timedelta(hours=1)
            elif frequency == 'minute':
                current_date += timedelta(minutes=1)
            elif frequency == 'second':
                current_date += timedelta(seconds=1)
            else:
                raise ValueError("Invalid frequency %s" % frequency)

    Writes a bunch of random data to output

    :param str output: Path to file to write
    :param str station_name: Name of the station as it should appear in CSV file
    :param datetime start_date: Start Date
    :param datetime end_date: End Date
    :param str frequency: Frequency of observations
    
Writes a bunch of random data to output
Writes a bunch of random data to output
def generate_csv(output, station_name, start_date, end_date, frequency):
    current_date = start_date
    with open(output, 'w') as csvfile:
        csv_writer = csv.writer(csvfile)
        csv_writer.writerow(['Station', 'Date/Time', 'Conductivity (S/m-1)',
                             'Temperature (deg_C)', 'Pressure (mbar)'])
        while current_date < end_date:
            row = generate_row(station_name, current_date)
            csv_writer.writerow(row)
            if frequency == 'hour':
                current_date += timedelta(hours=1)
            elif frequency == 'minute':
                current_date += timedelta(minutes=1)
            elif frequency == 'second':
                current_date += timedelta(seconds=1)
            else:
                raise ValueError("Invalid frequency %s" % frequency)
def generate_csv ( output , station_name , start_date , end_date , frequency ) : current_date = start_date with open ( output , 'w' ) as csvfile : csv_writer = csv . writer ( csvfile ) csv_writer . writerow ( [ 'Station' , 'Date/Time' , 'Conductivity (S/m-1)' , 'Temperature (deg_C)' , 'Pressure (mbar)' ] ) while current_date < end_date : row = generate_row ( station_name , current_date ) csv_writer . writerow ( row ) if frequency == 'hour' : current_date += timedelta ( hours = 1 ) elif frequency == 'minute' : current_date += timedelta ( minutes = 1 ) elif frequency == 'second' : current_date += timedelta ( seconds = 1 ) else : raise ValueError ( "Invalid frequency %s" % frequency )
Writes a bunch of random data to output
Writes a bunch of random data to output
'''
    Writes a bunch of random data to output

    :param str output: Path to file to write
    :param str station_name: Name of the station as it should appear in CSV file
    :param datetime start_date: Start Date
    :param datetime end_date: End Date
    :param str frequency: Frequency of observations
    '''
output
Path to file to write
Path to file to write
station_name
Name of the station as it should appear in CSV file
Name of the station as it should appear in CSV file
start_date
None
end_date
None
frequency
Frequency of observations
Frequency of observations