Пример #1
0
	newList = []
	for i in range(len(list)):
		numchars = charCounter(list[i])
		newList.append(stringtoarr(list[i], numchars))
	return newList

station_list = ["S001", "S002", "S003", "S004", "S005", "S006", "S007", "S008","S009", "S010", "S011", "S012"]
lat_list = [-150.0, -120.0, -90.0, -60.0, -30.0, 0.0, 30.0, 60.0, 90.0, 120.0, 150.0, 180.0]
lon_list = [-150.0, -120.0, -90.0, -60.0, -30.0, 0.0, 30.0, 60.0, 90.0, 120.0, 150.0, 180.0]
data_values = [17.0, 26.0, 58.0, 37.0, 45.0, 66.0, 27.0, -2.0, 7.0, 9.0, 23.0, 14.0]

# Main
try: 
    # global
    root_grp.description = "Test"
    root_grp.cdm_datatype = "Station"
    root_grp.stationDimension = "station_nm";
    root_grp.featureType = "TimeSeries";
    root_grp.conventions= "CF-1.6";
    baseDate = datetime(2001,3,1)
    root_grp.time_coverage_start = "2001-03-01 12:00:00";

    # dimensions
    root_grp.createDimension('time', None)
    root_grp.createDimension('station_nm', None) # stations unlimited = http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/cf-conventions.html#idp8314368
    # variables
    times = root_grp.createVariable('time', 'f8', ('time',))
    times.units = 'hours since 2001-03-01 12:00:00'
    #times.units = 'hours since 0001-01-01 00:00:00.0'
    times.calendar = 'gregorian'
    times.standard_name= 'time'