Exemplo n.º 1
0
 indx=S[d][s] # ship index
 index=T[d][s]# turtle index
 INDX=pd.Series(indx).unique()
 scales.append(str(day[d])+'day '+str(2*s)+'~'+str(2+2*s)+'km')
 n1=len(INDX)
 n2=len(pd.Series(index).unique())
 n3=len(turtle_id[pd.Series(index).unique()].unique())
 N1.append(n1)
 N2.append(n2)
 N3.append(n3)
 print 'number of ship profile,turtle profile,turtle: ',str(day[d])+'day '+str(2*s)+'~'+str(2+2*s)+'km',n1,n2,n3
 n_ID=[]
 num=0
 ID_turtle=[]
 for i in range(len(INDX)):
     wd1=-gettopo(shiplat[INDX[i]],shiplon[INDX[i]])
     bm1=shipdepth[INDX[i]][-1]
     diff_turVSship=[] # each ship pofile be compared with  many turtle profile in the difference of temp
     if bm1>=wd1*0.9:
         for j in range(len(indx)):
             if indx[j]==INDX[i]:
                 wd2=-gettopo(obslat[index[j]],obslon[index[j]])
                 bm2=obsDepth[index[j]][-1] # bottom depth of the turtle profile
                 if bm2>=wd2*0.9:
                     dif_turVSship=abs(obstemp[index[j]][-1]-shiptemp[INDX[i]][-1])
                     diff_turVSship.append(dif_turVSship)
                     ID_turtle.append(turtle_id[index[j]])
     if diff_turVSship ==[]:
         num+=1
     if diff_turVSship!=[]: #  some turtle dive on the surface ,but the ship data start from the deeper depth
         mean_turVSship=np.mean(np.array(diff_turVSship))                           
Exemplo n.º 2
0
from mpl_toolkits.basemap import Basemap
import pandas as pd
from turtleModule import draw_basemap
from gettopo import gettopo
ship = pd.read_csv('ship06-08_MODELtemp.csv')
lonship, latship = ship['LON'], ship['LAT']

ctd = pd.read_csv('ctd_extract_good.csv', index_col=0)
TF = ctd['TF']  # If True, data is good, if False, data is bad.
latGoodCTD, lonGoodCTD = ctd['LAT'][TF == True], ctd['LON'][TF == True]

contour_lon, contour_lat, contour_depth = [], [], []
for i in ship.index:
    contour_lon.append(lonship[i])
    contour_lat.append(latship[i])
    wd = -gettopo(latship[i], lonship[i])
    contour_depth.append(wd)
for i in latGoodCTD.index:
    contour_lon.append(lonGoodCTD[i])
    contour_lat.append(latGoodCTD[i])
    wd = -gettopo(latGoodCTD[i], lonGoodCTD[i])
    contour_depth.append(wd)
'''obsData = pd.read_csv('ctdWithdepthofbottom_roms.csv')
obsLon, obsLat = obsData['LON'], obsData['LAT']     #use for plotting depth line
depthBottom = pd.Series(obsData['depth_bottom'],index=obsData.index)
for i in obsData.index:
    if depthBottom[i]>200:
        depthBottom[i]=200
'''
lonsize = [-79.5, -64]
latsize = [33, 46]
Exemplo n.º 3
0
new_index = range(len(inde))
turtle_index.index = new_index
lon.index = new_index
lat.index = new_index
depth.index = new_index
'''turtle_index=pd.Series(data['index'][inde],index=new_index)
lon=pd.Series(data['lon'][inde],index=new_index) 
lat=pd.Series(data['lat'][inde],index=new_index)
 '''
water_depth = []  # get water depth according to lat and lon
for i in new_index:
    if i % 10000 == 0:
        print(i)
    if i == 0 or i == len(new_index) - 1:
        wd1 = -gettopo(
            lat[i], lon[i]
        )  # this is a function to get water depth from a USGS database
    elif turtle_index[i - 1] != turtle_index[i + 1]:
        wd1 = -gettopo(lat[i], lon[i])
    water_depth.append(wd1)
wd = pd.Series(water_depth, index=new_index)

indx = []  #find the start of downcast
for n in new_index:
    if depth[n] <= wd[n] * 0.1:  # use 2 beacuse some dives don`t go to air
        I = find_start(n, depth)
        indx.append(I)
    if n % 1000 == 0:
        print(I, n)
Indx = [list(x)
        for x in set(tuple(x) for x in indx)]  #get rid of repeated data
Exemplo n.º 4
0
inde=pd.Series(secondData['index'],index=tf_index1)
time.index=tf_index2
depth.index=tf_index2
temp.index=tf_index2
inde.index=tf_index2
indx=[]
for i in tf_index:
    if obsturtle_id[i]==118905:   #this turtle is same turtle with 4-second turtle
        indx.append(i)
obsLon, obsLat = obsData['LON'][indx], obsData['LAT'][indx]
obsTime = pd.Series(np_datetime(obsData['END_DATE'][indx]), index=indx)
obsTemp = pd.Series(str2ndlist(obsData['TEMP_VALS'][indx]), index=indx)
obsDepth = pd.Series(str2ndlist(obsData['TEMP_DBAR'][indx]), index=indx)
Waterdepth=[]
for i in indx:
    wd=-gettopo(obsLat[i],obsLon[i])
    Waterdepth.append(wd)
Waterdepth=pd.Series(Waterdepth, index=indx)
for i in indx[0:2]:
    waterdepth=Waterdepth[i]
    print 'waterdepth: '+ str(waterdepth)
    Index_all=[]   #find indices which are in same area
    for j in tf_index2:
        if i==inde[j]:
           Index_all.append(j)
    newdepth=pd.Series(depth,index=Index_all)
    newdepth.index=range(len(Index_all))
    newtime=pd.Series(time,index=Index_all)
    newtime.index=range(len(Index_all))
    newtime=pd.to_datetime(newtime)
    Index=[]   # all dives for each profile
Exemplo n.º 5
0
                i)  # obtain the number of the turtle profile more than one
AV = []
mean_STD = []

n = 0
for i in INDX1:  #[1727,4011,4801,8038]:#[3274,4557,9106]:##[4801]:#[656,5327,1728,8699]:###
    ix = []  #g_index[i]

    cd = max(depth[i])

    for j in np.arange(len(g_index[i])):
        d = max(depth[g_index[i][j]])
        if i == 4801:
            ix.append(g_index[i][j])
        if abs(cd - d) < 5:
            wd1 = -gettopo(lat[i], lon[i])
            wd2 = -gettopo(lat[g_index[i][j]], lon[g_index[i][j]])
            if cd >= wd1 * 0.9 and d >= wd2 * 0.9:
                ix.append(g_index[i][j])

    if ix != []:
        print i
        n += 1
        A = []
        S = []
        '''b=np.mean(temp[i])
        S.append(b)
        for k in range(len(ix)):
            c=np.mean(temp[ix[k]])
            a=b-c
            A.append(a)