Commit b8050f7a authored by Harish Chidanandappa's avatar Harish Chidanandappa
Browse files

No commit message

No commit message
parents
from matplotlib import pyplot
from pandas import read_csv
from pandas import DataFrame
import numpy as np
import pandas as pd
from math import sqrt
from numpy import concatenate
#Filtering the destination routes as rotterdam and hamburg for the data of north zone
df = pd.read_csv("G:\\Master Thesis\\northern_tss_v2.csv", sep=";",header= None)
df = pd.DataFrame(df.values, columns=["mmsi", "shiptype","Length","Breadth","Draught","Longitude","Latitude","SOG","COG","TH","Destination","Name","Callsign","time_UTC"])
#north.dropna(inplace = True)
#print (df.info())
Desti= df['Destination'].value_counts()
df = df.list()
aa = df[df['Destination'].isin(['HAMBURG', 'ROTTERDAM'])]
print( df.loc[df['Destination'] == 'HAMBURG'])
aa.head(10)
aa.Destination.value_counts()
#saving the filtered data of north zone
aa.to_csv(r"G:\\Master Thesis\\filtered_north.csv")
#Filtering the destination routes as rotterdam and hamburg for the data of south zone
df = pd.read_csv("G:\\Master Thesis\\southern_tss_v2.csv", sep=";",header= None)
df = pd.DataFrame(df.values, columns=["mmsi", "shiptype","Length","Breadth","Draught","Longitude","Latitude","SOG","COG","TH","Destination","Name","Callsign","time_UTC"])
#north.dropna(inplace = True)
#print (df.info())
Desti= df['Destination'].value_counts()
df = df.list()
aa = df[df['Destination'].isin(['HAMBURG', 'ROTTERDAM'])]
#print( df.loc[df['Destination'] == 'HAMBURG'])
aa.head(10)
aa.Destination.value_counts()
#saving the filtered data of south zone
aa.to_csv(r"G:\\Master Thesis\\filtered_south.csv")
#importing the weather station data
df = pd.read_csv("G:\\Master Thesis\\Weather stations data\\Daily mean of station observations of wind speed\\data\\data_FM_MN003.csv", sep=",",header= None)
df.rename(columns={ 0: 'Product_Code', 1: 'SDO_ID', 2: 'time_UTC', 3:'Value', 4: 'Quality_Level', 5:'Quality_Byte'}, inplace=True)
df.drop(df.index[0])
#save the weather data
df.to_csv(r"G:\\Master Thesis\\weather_data_wind.csv")
#to merge the data of weather and zones
#the data of the north zone is read as df
df = pd.read_csv("G:\\Master Thesis\\filtered_north.csv", sep=",")
df['time_UTC'] = df['time_UTC'].astype(int)
#the data of the south zone is read as df1
df1 = pd.read_csv("G:\\Master Thesis\\filtered_south.csv", sep=",")
df1['time_UTC'] = df1['time_UTC'].astype(int)
#the data of weather is read as df2
df2 = pd.read_csv("G:\\Master Thesis\\weather_data_wind.csv", sep=",")
df2.drop(df2.index[0])
df2['time_UTC'] = df2['time_UTC'].astype(int)
# merging the dataframes
df_merge_data = pd.merge(df,df1,df2, on='time_UTC')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment