#get input use function "get_emolt_test_step" (mindtime,maxdtime,i_mindepth,i_maxdepth,b_mindepth,b_maxdepth,lat_max,\ lon_max,lat_min,lon_min,site,num)=getemolt_ctl(inputfilename) # get data from ctl file #change format of date to get datetime format f = open(str(int(lat_min))+'.txt', 'w') f.writelines('site'+' '+'lat '+' lon '+' depth'+' '+' time'+' '+'temp(F)'+'\n') for aaa in range(num): # number pieces of date mindtime1=mindtime.strftime("%d-%b-%Y") maxdtime1=num2date((date2num(maxdtime))+1).strftime("%d-%b-%Y") #we need to add 1 day,because start time of one day is 00:00 maxdtime11=maxdtime.strftime("%d-%b-%Y") #when user don't input sites,get data from url if site=='': site2='' site1='' (sites2,depth_b,lat_dd,lon_dd)=getemolt_depth(b_mindepth,b_maxdepth,lat_max,\ lon_max,lat_min,lon_min,site1) (time1,yrday01,temp1,sites1,depth)=getemolt_sensor(mindtime1,\ maxdtime1,i_mindepth,i_maxdepth,site2,mindtime,maxdtime) #when user input sites,get data from url,change their format else: time1,yrday01,temp1,sites1,sites2,depth_b,depth=[],[],[],[],[],[],[] for o in range(len(site)): # change site format for using it in url site1='&emolt_site.SITE="'+site[o]+'"' site2='&emolt_sensor.SITE="'+site[o]+'"' (time31,yrday301,temp31,sites31,depth_i,time1)=getemolt_sensor(mindtime1,\ maxdtime1,i_mindepth,i_maxdepth,site2,mindtime,maxdtime) for p in range(len(sites31)): time1.append(time31[p])
num=int(num[0:num.index(']')].strip('[')) #get input use function "get_emolt_test_step" #(mindtime,maxdtime,i_mindepth,i_maxdepth,b_mindepth,b_maxdepth,lat_max,lon_max,lat_min,lon_min,site,num)=getemolt_ctl(inputfilename) # get data from ctl file #change format of date to get datetime format f = open(str(int(lat_min))+'.txt', 'w') f.writelines('site'+' '+'lat '+' lon '+' depth'+' '+' time'+' '+'temp(F)'+'\n') for aaa in range(num): # number pieces of date mindtime1=mindtime.strftime("%d-%b-%Y") maxdtime1=num2date((date2num(maxdtime))+1).strftime("%d-%b-%Y") #we need to add 1 day,because start time of one day is 00:00 maxdtime11=maxdtime.strftime("%d-%b-%Y") #when user don't input sites,get data from url if site=='': site2='' site1='' (sites2,depth_b,lat_dd,lon_dd)=getemolt_depth(b_mindepth,b_maxdepth,lat_max,\ lon_max,lat_min,lon_min,site1) (time1,yrday01,temp1,sites1,depth)=getemolt_sensor(mindtime1,\ maxdtime1,i_mindepth,i_maxdepth,site2,mindtime,maxdtime) #when user input sites,get data from url,change their format else: time1,yrday01,temp1,sites1,sites2,depth_b,depth=[],[],[],[],[],[],[] for o in range(len(site)): # change site format for using it in url site1='&emolt_site.SITE="'+site[o]+'"' site2='&emolt_sensor.SITE="'+site[o]+'"' url2="http://gisweb.wh.whoi.edu:8080/dods/whoi/emolt_sensor?emolt_sensor.SITE,emolt_sensor.TIME_LOCAL,emolt_sensor.YRDAY0_LOCAL,emolt_sensor.TEMP,emolt_sensor.DEPTH_I&emolt_sensor.TIME_LOCAL>="+str(mindtime1)+"&emolt_sensor.TIME_LOCAL<="+str(maxdtime1)+"&emolt_sensor.DEPTH_I>="+str(i_mindepth)+"&emolt_sensor.DEPTH_I<="+str(i_maxdepth)+site2 dataset1=open_url(url2)
lon_max,lat_min,lon_min,polygon,site,num)=getemolt_ctl_py() # get data from py ctl file else: (mindtime,maxdtime,i_mindepth,i_maxdepth,b_mindepth,b_maxdepth,lat_max,\ lon_max,lat_min,lon_min,polygon,site,num)=getemolt_ctl(inputfilename) # get data from txt ctl file #change format of date to get datetime format f = open(str(int(lat_min))+'1.dat', 'w') f.writelines('site'+' '+'lat '+' lon '+' depth(F)'+' '+' time'+' '+'temp(F)'+'\n') for aaa in range(num): print aaa # number pieces of date mindtime1=mindtime.strftime("%d-%b-%Y") maxdtime1=num2date((date2num(maxdtime))+1).strftime("%d-%b-%Y") #we need to add 1 day,because start time of one day is 00:00 maxdtime11=maxdtime.strftime("%d-%b-%Y") #when user don't input sites,get data from url if site=='': (sites2,depth_b,lat_dd,lon_dd)=getemolt_depth(b_mindepth,b_maxdepth,lat_max,\ lon_max,lat_min,lon_min,site) (time1,yrday1,temp1,sites1,depth)=getemolt_sensor(mindtime1,\ maxdtime1,i_mindepth,i_maxdepth,site,mindtime,maxdtime) print len(time1) #when user input sites,get data from url,change their format else: time1,yrday1,temp1,sites1,sites2,depth_b,depth=[],[],[],[],[],[],[] #change format from array to list for o in range(len(site)): # change site format for using it in url site1='&emolt_site.SITE="'+site[o]+'"' site2='&emolt_sensor.SITE="'+site[o]+'"' (time1,yrday1,temp1,sites1,depth)=getemolt_sensor(mindtime1,maxdtime1,i_mindepth,i_maxdepth,'&emolt_sensor.SITE="'+site[o]+'"',mindtime,maxdtime) (sites2,depth_b,lat_dd,lon_dd)=getemolt_depth(b_mindepth,b_maxdepth,lat_max,lon_max,lat_min,lon_min,'&emolt_site.SITE="'+site[o]+'"')