Пример #1
0
@author: zhaobin
"""
'plot number of observation in 1 minute square'

import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.mlab import griddata
import numpy as np
import sys
sys.path.append('../modules')
from conversions_old import dm2dd
from turtleModule import draw_basemap, whichArea
########################################################################
one_minute = 1.0 / 60  #1.0/60 is 1 minute
data = pd.read_csv('binned_td_hoey.csv')
lat, lon = dm2dd(data['LATITUDE'],
                 data['LONGITUDE'])  #convert ddmm.m to dd.ddd
lat_i = np.arange(min(lat), max(lat), one_minute)
lon_i = np.arange(min(lon), max(lon), one_minute)
number = []
for i in range(len(lon_i)):
    j = [0] * len(lat_i)
    number.append(j)
lat_n = []
lon_m = []
for i in range(len(lat)):
    n = whichArea(lat[i], lat_i)
    m = whichArea(lon[i], lon_i)
    number[m][n] += 1  # calculate number in 1 minute square
lonsize = [min(lon), max(lon)]
latsize = [min(lat), max(lat)]
lon_is = np.linspace(lonsize[0], lonsize[1], 1000)
Пример #2
0
    else:
        df['MEAN_DEPTH'][i] = float(df['MEAN_DEPTH'][i])
    if df['MIN_DEPTH'][
            i] == '                                                                                                                               ':
        df['MIN_DEPTH'][i] = df['MEAN_DEPTH'][i]
    else:
        df['MIN_DEPTH'][i] = float(df['MIN_DEPTH'][i])
    if df['MAX_DEPTH'][
            i] == '                                                                                                                               ':
        df['MAX_DEPTH'][i] = df['MEAN_DEPTH'][i]
    else:
        df['MAX_DEPTH'][i] = float(
            df['MAX_DEPTH'][i]
        )  #change str to float . some mean depths are empty.change them to 0.
#convert ddmm.m to dd.ddd
[la, lo] = dm2dd(df['LATITUDE'], df['LONGITUDE'])

# Now we have a data frame, we can start plotting it
# make basemap
llLat = min(la)
urLat = max(la)
llLon = min(lo)
urLon = max(lo)

# Summary plot

m = Basemap(projection='cyl', llcrnrlat=llLat, urcrnrlat=urLat, \
                    llcrnrlon=llLon, urcrnrlon=urLon,resolution='h')
m.drawcoastlines()
m.fillcontinents(color='gray')
m.drawparallels(np.arange(round(llLat), round(urLat), 1.), labels=[1, 0, 0, 0])
Пример #3
0
@author: zhaobin
"""
'plot number of observation in 10 minute square'
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib.patches import Rectangle
from datetime import datetime,timedelta
import numpy as np
from conversions_old import dm2dd
from turtleModule import draw_basemap,whichArea
###############################################################
ten_minute=10.0/60
data=pd.read_csv('binned_td_hoey.csv')
lat,lon=dm2dd(data['LATITUDE'],data['LONGITUDE']) #convert ddmm.m to dd.ddd
for i in range(len(data)):
    data['datet'][i]=datetime.strptime(data['datet'][i],'%Y-%m-%d %H:%M:%S')
lat_i=np.arange(int(min(lat)),int(max(lat)),ten_minute)   
lon_i=np.arange(int(min(lon)),int(max(lon)),ten_minute) 
number=[]
for q in range(10):
    number.append([])
    for i in range(len(lon_i)):
        j=[0]*len(lat_i)
        number[q].append(j)
lat_n=[]
lon_m=[]
for i in range(len(lat)):
    for j in range(10):                  #10 is 10 years,from 2006 to 2015
        if data['datet'][i].year==2006+j:
Пример #4
0
df=read_csv(direct+fn,sep=',',skiprows=0,parse_dates={'datet':[2]},index_col='datet',date_parser=parse,names=['LATITUDE','LONGITUDE','ROUND_DATE_TIME','OBSERVATIONS_TEMP','MEAN_TEMP','MIN_TEMP','MAX_TEMP','STD_DEV_TEMP','OBSERVATIONS_DEPTH','MEAN_DEPTH','MIN_DEPTH','MAX_DEPTH','STD_DEV_DEPTH','nan'])
for i in range(len(df)):
    if df['MEAN_DEPTH'][i]=='                                                                                                                               ':
        df['MEAN_DEPTH'][i]=0
    else:
        df['MEAN_DEPTH'][i]=float(df['MEAN_DEPTH'][i])
    if df['MIN_DEPTH'][i]=='                                                                                                                               ':
        df['MIN_DEPTH'][i]=df['MEAN_DEPTH'][i]
    else:
        df['MIN_DEPTH'][i]=float(df['MIN_DEPTH'][i])
    if df['MAX_DEPTH'][i]=='                                                                                                                               ':
        df['MAX_DEPTH'][i]=df['MEAN_DEPTH'][i]
    else:
        df['MAX_DEPTH'][i]=float(df['MAX_DEPTH'][i])   #change str to float . some mean depths are empty.change them to 0.
#convert ddmm.m to dd.ddd
[la,lo]=dm2dd(df['LATITUDE'],df['LONGITUDE'])

# Now we have a data frame, we can start plotting it
# make basemap
llLat=min(la)
urLat=max(la)
llLon=min(lo)
urLon=max(lo)

# Summary plot

m = Basemap(projection='cyl', llcrnrlat=llLat, urcrnrlat=urLat, \
                    llcrnrlon=llLon, urcrnrlon=urLon,resolution='h')
m.drawcoastlines()
m.fillcontinents(color='gray')
m.drawparallels(np.arange(round(llLat), round(urLat),1.), labels=[1, 0, 0, 0])