NTC and Mustique Updates
This commit is contained in:
parent
d271c30de0
commit
ecfa7c23f7
|
|
@ -1,3 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -4,11 +4,18 @@
|
|||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
"collapsed": true,
|
||||
"pycharm": {
|
||||
"name": "#%% Setup\n"
|
||||
}
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
""
|
||||
"#import jupyter\n",
|
||||
"import os\n",
|
||||
"import pandas as pd\n",
|
||||
"import geopandas as gpd\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/data" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="renderExternalDocumentation" value="true" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="bool.*" />
|
||||
<option value="geopandas.io.file" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (BairdBase)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/Mustique.iml" filepath="$PROJECT_DIR$/.idea/Mustique.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PySciProjectComponent">
|
||||
<option name="PY_SCI_VIEW" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (NEMA)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/NEMA.iml" filepath="$PROJECT_DIR$/.idea/NEMA.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
import pynmea2
|
||||
from pynmea2 import TalkerSentence
|
||||
from decimal import Decimal
|
||||
|
||||
class M01(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Latitude", "Lat", Decimal),
|
||||
("Longitude", "Lon", Decimal),
|
||||
("Average Pressure", "AvePres", Decimal),
|
||||
("Air Temperature", "AirTemp", Decimal),
|
||||
("Humidity", "Humidity", Decimal),
|
||||
("Dew Point", "DewPoint", Decimal),
|
||||
("WndYng5m", "WndYng5m", Decimal),
|
||||
("WndDirYng", "WndDirYng", Decimal),
|
||||
("WndGstYng", "WndGstYng", Decimal),
|
||||
("WndGil4m", "WndGil4m", Decimal),
|
||||
("WndDirGil", "WndDirGil", Decimal),
|
||||
("WndGstGil", "WndGstGil", Decimal),
|
||||
)
|
||||
|
||||
class M02(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Min Voltage", "MinVolt", Decimal),
|
||||
("Max Voltage", "AveVolt", Decimal),
|
||||
("Average Node Current", "AveNodeCur", Decimal),
|
||||
("Max Node Current", "MaxNodeCur", Decimal),
|
||||
("Sensor 1 Average Current", "Sen1AveCur", Decimal),
|
||||
("Wh_dayEst", "Wh_dayEst", Decimal),
|
||||
("unknown1", "unknown1", Decimal),
|
||||
("H20 Intrusn", "H20_Intrusn", Decimal),
|
||||
("PCB Temperature", "PCBTemp", Decimal),
|
||||
("Boot Timestamp", "BootTimestamp", Decimal),
|
||||
("Num Resets", "NumResets", Decimal),
|
||||
("Shutdown Type", "ShutdownType", Decimal),
|
||||
("AveServices_Sec", "AveServices_Sec", Decimal),
|
||||
("Log Error Count", "LogErrorCnt", Decimal),
|
||||
("Error Count", "ErrorCount", Decimal),
|
||||
("Free Space", "FreeSpace", Decimal),
|
||||
("Watch Circle Status", "WatchcircleStatus", Decimal),
|
||||
("Ave Heading", "AveHeading", Decimal),
|
||||
("Ave Pressure", "AvePres", Decimal),
|
||||
)
|
||||
|
||||
class M03(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Hs", "Hs", Decimal),
|
||||
("Hmax", "Hmax", Decimal),
|
||||
("Tp", "Tp", Decimal),
|
||||
("MWD", "MWD", Decimal),
|
||||
("MeanSpread", "MeanSpread", Decimal),
|
||||
)
|
||||
|
||||
class M04(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Velocity Cell 1", "Vel_Cell_1", Decimal),
|
||||
("True Direction Cell 1", "DirTrue1", Decimal),
|
||||
("Velocity Cell 2", "Vel_Cell_2", Decimal),
|
||||
("True Direction Cell 2", "DirTrue2", Decimal),
|
||||
("Velocity Cell 3", "Vel_Cell_3", Decimal),
|
||||
("True Direction Cell 3", "DirTrue3", Decimal),
|
||||
("Velocity Cell 4", "Vel_Cell_4", Decimal),
|
||||
("True Direction Cell 4", "DirTrue4", Decimal),
|
||||
("Velocity Cell 5", "Vel_Cell_5", Decimal),
|
||||
("True Direction Cell 5", "DirTrue5", Decimal),
|
||||
("Velocity Cell 6", "Vel_Cell_6", Decimal),
|
||||
("True Direction Cell 6", "DirTru6", Decimal),
|
||||
("Velocity Cell 7", "Vel_Cell_7", Decimal),
|
||||
("True Direction Cell 7", "DirTrue7", Decimal),
|
||||
("Velocity Cell 8", "Vel_Cell_8", Decimal),
|
||||
("True Direction Cell 8", "DirTrue8", Decimal),
|
||||
("Velocity Cell 9", "Vel_Cell_9", Decimal),
|
||||
("True Direction Cell 9", "DirTrue9", Decimal),
|
||||
("Velocity Cell 10", "Vel_Cell_10", Decimal),
|
||||
("True Direction Cell 10", "DirTrue10", Decimal),
|
||||
("Velocity Cell 11", "Vel_Cell_11", Decimal),
|
||||
("True Direction Cell 11", "DirTrue11", Decimal),
|
||||
("Velocity Cell 12", "Vel_Cell_12", Decimal),
|
||||
("True Direction Cell 12", "DirTrue12", Decimal),
|
||||
("Velocity Cell 13", "Vel_Cell_13", Decimal),
|
||||
("True Direction Cell 13", "DirTrue13", Decimal),
|
||||
("Velocity Cell 14", "Vel_Cell_14", Decimal),
|
||||
("True Direction Cell 14", "DirTrue14", Decimal),
|
||||
("Velocity Cell 15", "Vel_Cell_15", Decimal),
|
||||
("True Direction Cell 15", "DirTrue15", Decimal),
|
||||
("Velocity Cell 16", "Vel_Cell_16", Decimal),
|
||||
("True Direction Cell 16", "DirTrue16", Decimal),
|
||||
("Velocity Cell 17", "Vel_Cell_17", Decimal),
|
||||
("True Direction Cell 17", "DirTrue17", Decimal),
|
||||
("Velocity Cell 18", "Vel_Cell_18", Decimal),
|
||||
("True Direction Cell 18", "DirTrue18", Decimal),
|
||||
("Velocity Cell 19", "Vel_Cell_19", Decimal),
|
||||
("True Direction Cell 19", "DirTrue19", Decimal),
|
||||
("Velocity Cell 20", "Vel_Cell_20", Decimal),
|
||||
("True Direction Cell 20", "DirTrue20", Decimal),
|
||||
)
|
||||
|
||||
class M10(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Latitude", "Lat", Decimal),
|
||||
("Longitude", "Lon", Decimal),
|
||||
("Watchcircle Status", "WatchcircleStatus", Decimal),
|
||||
("Ave Volt", "AveVolt", Decimal),
|
||||
("H2OIntrusnVolt", "H2OIntrusnVolt", Decimal),
|
||||
)
|
||||
f = open("20200601_MESSAGE.log", "r")
|
||||
|
||||
parsed = []
|
||||
|
||||
while True:
|
||||
msg = f.readline()
|
||||
if not msg :
|
||||
break;
|
||||
msgNMEA = msg[23:len(msg)-4]
|
||||
|
||||
if msgNMEA[38]=='1':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M01', 1)
|
||||
elif msgNMEA[38]=='2':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M02', )
|
||||
elif msgNMEA[38]=='3':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M03', 1)
|
||||
elif msgNMEA[38]=='4':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M04', 1)
|
||||
elif msgNMEA[38]=='10':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M10', 1)
|
||||
|
||||
parsed.append(pynmea2.parse(msgNMEA, check=False))
|
||||
|
||||
f.close()
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
def readNema_fun(fName):
|
||||
import pynmea2
|
||||
from pynmea2 import TalkerSentence
|
||||
from decimal import Decimal
|
||||
|
||||
class M01(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Latitude", "Lat", Decimal),
|
||||
("Longitude", "Lon", Decimal),
|
||||
("Average Pressure", "AvePres", Decimal),
|
||||
("Air Temperature", "AirTemp", Decimal),
|
||||
("Humidity", "Humidity", Decimal),
|
||||
("Dew Point", "DewPoint", Decimal),
|
||||
("WndYng5m", "WndYng5m", Decimal),
|
||||
("WndDirYng", "WndDirYng", Decimal),
|
||||
("WndGstYng", "WndGstYng", Decimal),
|
||||
("WndGil4m", "WndGil4m", Decimal),
|
||||
("WndDirGil", "WndDirGil", Decimal),
|
||||
("WndGstGil", "WndGstGil", Decimal),
|
||||
)
|
||||
|
||||
class M02(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Min Voltage", "MinVolt", Decimal),
|
||||
("Max Voltage", "AveVolt", Decimal),
|
||||
("Average Node Current", "AveNodeCur", Decimal),
|
||||
("Max Node Current", "MaxNodeCur", Decimal),
|
||||
("Sensor 1 Average Current", "Sen1AveCur", Decimal),
|
||||
("Wh_dayEst", "Wh_dayEst", Decimal),
|
||||
("unknown1", "unknown1", Decimal),
|
||||
("H20 Intrusn", "H20_Intrusn", Decimal),
|
||||
("PCB Temperature", "PCBTemp", Decimal),
|
||||
("Boot Timestamp", "BootTimestamp", Decimal),
|
||||
("Num Resets", "NumResets", Decimal),
|
||||
("Shutdown Type", "ShutdownType", Decimal),
|
||||
("AveServices_Sec", "AveServices_Sec", Decimal),
|
||||
("Log Error Count", "LogErrorCnt", Decimal),
|
||||
("Error Count", "ErrorCount", Decimal),
|
||||
("Free Space", "FreeSpace", Decimal),
|
||||
("Watch Circle Status", "WatchcircleStatus", Decimal),
|
||||
("Ave Heading", "AveHeading", Decimal),
|
||||
("Ave Pressure", "AvePres", Decimal),
|
||||
)
|
||||
|
||||
class M03(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Hs", "Hs", Decimal),
|
||||
("Hmax", "Hmax", Decimal),
|
||||
("Tp", "Tp", Decimal),
|
||||
("MWD", "MWD", Decimal),
|
||||
("MeanSpread", "MeanSpread", Decimal),
|
||||
)
|
||||
|
||||
class M04(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Velocity Cell 1", "Vel_Cell_1", Decimal),
|
||||
("True Direction Cell 1", "DirTrue1", Decimal),
|
||||
("Velocity Cell 2", "Vel_Cell_2", Decimal),
|
||||
("True Direction Cell 2", "DirTrue2", Decimal),
|
||||
("Velocity Cell 3", "Vel_Cell_3", Decimal),
|
||||
("True Direction Cell 3", "DirTrue3", Decimal),
|
||||
("Velocity Cell 4", "Vel_Cell_4", Decimal),
|
||||
("True Direction Cell 4", "DirTrue4", Decimal),
|
||||
("Velocity Cell 5", "Vel_Cell_5", Decimal),
|
||||
("True Direction Cell 5", "DirTrue5", Decimal),
|
||||
("Velocity Cell 6", "Vel_Cell_6", Decimal),
|
||||
("True Direction Cell 6", "DirTru6", Decimal),
|
||||
("Velocity Cell 7", "Vel_Cell_7", Decimal),
|
||||
("True Direction Cell 7", "DirTrue7", Decimal),
|
||||
("Velocity Cell 8", "Vel_Cell_8", Decimal),
|
||||
("True Direction Cell 8", "DirTrue8", Decimal),
|
||||
("Velocity Cell 9", "Vel_Cell_9", Decimal),
|
||||
("True Direction Cell 9", "DirTrue9", Decimal),
|
||||
("Velocity Cell 10", "Vel_Cell_10", Decimal),
|
||||
("True Direction Cell 10", "DirTrue10", Decimal),
|
||||
("Velocity Cell 11", "Vel_Cell_11", Decimal),
|
||||
("True Direction Cell 11", "DirTrue11", Decimal),
|
||||
("Velocity Cell 12", "Vel_Cell_12", Decimal),
|
||||
("True Direction Cell 12", "DirTrue12", Decimal),
|
||||
("Velocity Cell 13", "Vel_Cell_13", Decimal),
|
||||
("True Direction Cell 13", "DirTrue13", Decimal),
|
||||
("Velocity Cell 14", "Vel_Cell_14", Decimal),
|
||||
("True Direction Cell 14", "DirTrue14", Decimal),
|
||||
("Velocity Cell 15", "Vel_Cell_15", Decimal),
|
||||
("True Direction Cell 15", "DirTrue15", Decimal),
|
||||
("Velocity Cell 16", "Vel_Cell_16", Decimal),
|
||||
("True Direction Cell 16", "DirTrue16", Decimal),
|
||||
("Velocity Cell 17", "Vel_Cell_17", Decimal),
|
||||
("True Direction Cell 17", "DirTrue17", Decimal),
|
||||
("Velocity Cell 18", "Vel_Cell_18", Decimal),
|
||||
("True Direction Cell 18", "DirTrue18", Decimal),
|
||||
("Velocity Cell 19", "Vel_Cell_19", Decimal),
|
||||
("True Direction Cell 19", "DirTrue19", Decimal),
|
||||
("Velocity Cell 20", "Vel_Cell_20", Decimal),
|
||||
("True Direction Cell 20", "DirTrue20", Decimal),
|
||||
)
|
||||
|
||||
class M10(TalkerSentence):
|
||||
fields = (
|
||||
("Date", "Date", Decimal),
|
||||
("Time", "Time", Decimal),
|
||||
("Buoy ID", "BuoyID", Decimal),
|
||||
("Message ID", "MessageID", Decimal),
|
||||
("Latitude", "Lat", Decimal),
|
||||
("Longitude", "Lon", Decimal),
|
||||
("Watchcircle Status", "WatchcircleStatus", Decimal),
|
||||
("Ave Volt", "AveVolt", Decimal),
|
||||
("H2OIntrusnVolt", "H2OIntrusnVolt", Decimal),
|
||||
)
|
||||
|
||||
f = open(fName, "r")
|
||||
parsed = []
|
||||
|
||||
while True:
|
||||
msg = f.readline()
|
||||
if not msg:
|
||||
break;
|
||||
|
||||
msgNMEA = msg[23:len(msg) - 4]
|
||||
|
||||
if msgNMEA[38] == '1':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M01', 1)
|
||||
elif msgNMEA[38] == '2':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M02', )
|
||||
elif msgNMEA[38] == '3':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M03', 1)
|
||||
elif msgNMEA[38] == '4':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M04', 1)
|
||||
msgNMEA = msgNMEA.replace('@&2C', ',')
|
||||
elif msgNMEA[38] == '10':
|
||||
msgNMEA = msgNMEA.replace('W5M5A', 'W5M10', 1)
|
||||
|
||||
parsed.append(pynmea2.parse(msgNMEA, check=False))
|
||||
f.close()
|
||||
return parsed
|
||||
|
|
@ -21,6 +21,7 @@ import contextily as ctx
|
|||
import os
|
||||
from shapely.geometry import Point
|
||||
|
||||
import pickle
|
||||
# %% read in data
|
||||
dataPath = '//srv-ott3/Projects/11934.201 Newtown Creek TPP – Privileged and Confidential/05_Analyses/07 ADCP/NC_CurrentMeter_All_Phase1_all_data_2012_05_20/'
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ transects = gdf['transect'].unique()
|
|||
|
||||
kernel = Gaussian2DKernel(x_stddev=0.25)
|
||||
|
||||
for transect_id in transects[range(221, 241)]:
|
||||
for transect_id in transects:
|
||||
# Select a given trasect
|
||||
tMask = (gdf['transect']==transect_id)
|
||||
# Remove rows without locations
|
||||
|
|
@ -91,6 +92,7 @@ for transect_id in transects[range(221, 241)]:
|
|||
|
||||
# get velocity data all rows columns 11-43
|
||||
V = gdf.values[tMask, 11:43].astype(float)
|
||||
|
||||
# #__________________________________________________________________________________________________________________________
|
||||
# %% Plotting
|
||||
if transectCount == 0:
|
||||
|
|
@ -124,9 +126,12 @@ for transect_id in transects[range(221, 241)]:
|
|||
transectCount = transectCount + 1
|
||||
|
||||
plt.show()
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/Transects221-241.png',
|
||||
bbox_inches='tight', dpi=300)
|
||||
# fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/Transects221-241.png',
|
||||
# bbox_inches='tight', dpi=300)
|
||||
|
||||
# %% Save Transects
|
||||
gdf.loc[:, df.columns != 'geometry'].to_xarray().to_netcdf(
|
||||
'C:/Users/arey/files/Projects/Newtown/DataFigs/NetCDF/Transects.nc')
|
||||
|
||||
# %% Load in moored data
|
||||
df_moored_data = pd.read_excel('//srv-ott3/Projects/11934.201 Newtown Creek TPP – Privileged and Confidential/03_Data/02_Physical/05 Currents/NC_CurrentMeter_All_Phase1_all_data_2013_07_16/NC_CurrentMeter_All_Phase1_all_moored_2013_05_20.xlsx',
|
||||
|
|
@ -186,6 +191,10 @@ gdf_moored['date'] = pd.to_datetime(gdf_moored['year'].astype(str) + '-' +
|
|||
gdf_moored['minute'].astype(str).str.zfill(2))
|
||||
|
||||
|
||||
# %% ADCP1
|
||||
gdf_moored.iloc[:, 1:-2].to_xarray().to_netcdf(
|
||||
'C:/Users/arey/files/Projects/Newtown/DataFigs/NetCDF/ADCP1.nc')
|
||||
|
||||
# %% Plot moored data
|
||||
# Column names to distances data for plotting
|
||||
depths1 = gdf_moored.columns[8:51] # ADCP sensor depth reading column names to list
|
||||
|
|
@ -226,8 +235,8 @@ for d in range(1,12):
|
|||
|
||||
plt.show()
|
||||
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/ADCP_2012.png',
|
||||
bbox_inches='tight', dpi=300)
|
||||
# fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/ADCP_2012.png',
|
||||
# bbox_inches='tight', dpi=300)
|
||||
|
||||
|
||||
# %% Load in ADCP2 data
|
||||
|
|
@ -282,6 +291,16 @@ for depIDX, adcp2_path in enumerate(adcp2_paths):
|
|||
|
||||
if depIDX+1 not in adcp2_gdfs[adcp2_file[advStrIDX:advStrIDX + 3]][adcp2_file[0:advStrIDX - 1]]:
|
||||
adcp2_gdfs[adcp2_file[advStrIDX:advStrIDX + 3]][adcp2_file[0:advStrIDX - 1]][depIDX+1] = gdf_in
|
||||
# %% ADCP2
|
||||
for stationIDX, stat in enumerate(adcp2_gdfs):
|
||||
for varIDX, var in enumerate(adcp2_gdfs[stat]):
|
||||
for depIDX, depdat in enumerate(adcp2_gdfs[stat][var]):
|
||||
ncDat = adcp2_gdfs[stat][var][depdat].iloc[:, 1:-2]
|
||||
ncDat.to_xarray().to_netcdf(
|
||||
'C:/Users/arey/files/Projects/Newtown/DataFigs/NetCDF/ADCP2/' +
|
||||
stat + '_' + var + '_d' + str(depdat) + '.nc')
|
||||
|
||||
gdf_adcp2_locs.to_csv('C:/Users/arey/files/Projects/Newtown/DataFigs/NetCDF/ADCP2/ADCP2locations.csv')
|
||||
|
||||
# %% Plot ADCP2 Data
|
||||
fig, axes = plt.subplots(nrows=6, ncols=1, figsize=(9, 8))
|
||||
|
|
@ -321,8 +340,8 @@ for stationIDX, stat in enumerate(adcp2_gdfs):
|
|||
plt.show()
|
||||
|
||||
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/ADCP_2014.png',
|
||||
bbox_inches='tight', dpi=300)
|
||||
# fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/ADCP_2014.png',
|
||||
# bbox_inches='tight', dpi=300)
|
||||
|
||||
# %% Load in Water Level Data
|
||||
# Gauge Locations from map
|
||||
|
|
@ -377,8 +396,8 @@ axes.set_title('Water Surface Elevation')
|
|||
axes.legend()
|
||||
|
||||
fig.show()
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/WaterLevel.png',
|
||||
bbox_inches='tight', dpi=300)
|
||||
# fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/WaterLevel.png',
|
||||
# bbox_inches='tight', dpi=300)
|
||||
|
||||
|
||||
|
||||
|
|
@ -445,6 +464,9 @@ gdf_SpringSummerDat = gp.GeoDataFrame(
|
|||
df_SpringSummerDat, geometry=gp.points_from_xy(df_SpringSummerDat.x_coord_as_numeric, df_SpringSummerDat.y_coord_as_numeric), crs="EPSG:2263")
|
||||
gdf_SpringSummerDat.geometry = gdf_SpringSummerDat.geometry.to_crs("EPSG:32118")
|
||||
|
||||
# %% Save temperature and salinity data
|
||||
gdf_SpringSummerDat.to_csv('C:/Users/arey/files/Projects/Newtown/DataFigs/NetCDF/TempSal/Spring_Summer.csv')
|
||||
|
||||
# %% Plot Salinity Time series
|
||||
fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(6, 8))
|
||||
plotMaskStation = (gdf_tdat.SourceArea == 'Newtown Creek') | (gdf_tdat.SourceArea == 'East Branch of Newtown Creek')
|
||||
|
|
@ -468,8 +490,8 @@ cbar.set_label('Salinity [PSU]')
|
|||
pltDat.set_clim([5, 40])
|
||||
|
||||
fig.show()
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/Salinity.png',
|
||||
bbox_inches='tight', dpi=300)
|
||||
# fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/Salinity.png',
|
||||
# bbox_inches='tight', dpi=300)
|
||||
|
||||
|
||||
|
||||
|
|
@ -508,7 +530,118 @@ axes[i].set_xlabel('Date')
|
|||
fig.show()
|
||||
|
||||
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/Temperature.png',
|
||||
# fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/Temperature.png',
|
||||
# bbox_inches='tight', dpi=300)
|
||||
|
||||
# %% Load in ADV data
|
||||
|
||||
# Read in locations
|
||||
df_adv_locs = pd.read_excel('//srv-ott3/Projects/11934.201 Newtown Creek TPP – Privileged and Confidential/03_Data/02_Physical/05 Currents/Velocity_Data_Compiled/Phase2/Locations/AQ_LocationsSO_ADCP_ADV_overview_Coords_20150126_AJMR.xlsx',
|
||||
sheet_name='ADV2')
|
||||
gdf_adv_locs = gp.GeoDataFrame(df_adv_locs,
|
||||
geometry=gp.points_from_xy(df_adv_locs.X_NYSPLI, df_adv_locs.Y_NYSPLI), crs="EPSG:2263")
|
||||
gdf_adv_locs = gdf_adv_locs.to_crs("EPSG:32118")
|
||||
|
||||
|
||||
adv_data_path = '//srv-ott3/Projects/11934.201 Newtown Creek TPP – Privileged and Confidential/03_Data/02_Physical/05 Currents/Velocity_Data_Compiled/Phase2/Raw'
|
||||
|
||||
adv_paths = ['NCP2_ADV_D1-D2/ADV_D1_070914_080214', 'NCP2_ADV_D1-D2/ADV_D2_080214_090814',
|
||||
'NCP2_ADV_D3-D4/ADV_D3_090914_100614', 'NCP2_ADV_D3-D4/ADV_D4_100714_110214',
|
||||
'NCP2_ADV_D5-D6/ADV_D5_110414_120214', 'NCP2_ADV_D5-D6/ADV_D6_120414_010615']
|
||||
|
||||
adv_gdfs = dict()
|
||||
adv_dfs = dict()
|
||||
|
||||
for depIDX, adv_path in enumerate(adv_paths):
|
||||
adv_files = os.listdir(adv_data_path + '/' + adv_path) # returns list of files in adv folder
|
||||
|
||||
for adv_file in adv_files:
|
||||
if '.txt' in adv_file and 'Readme' not in adv_file:
|
||||
df_in = pd.read_csv(adv_data_path + '/' + adv_path + '/' + adv_file, delim_whitespace=True, skipinitialspace=True)
|
||||
|
||||
for stationIDX, station in enumerate(gdf_adv_locs['parent_loc_code']):
|
||||
if adv_file[-9:-6] in station:
|
||||
# adv_geo_x = np.ones([len(df_in), 1]) * df_adv_locs.X_NYSPLI[stationIDX]
|
||||
# adv_geo_y = np.ones([len(df_in), 1]) * df_adv_locs.Y_NYSPLI[stationIDX]
|
||||
|
||||
|
||||
df_in['date'] = pd.to_datetime(df_in['Year'].astype(str) + '-' + df_in['Month'].astype(
|
||||
str).str.zfill(2) + '-' + df_in['Day'].astype(
|
||||
str).str.zfill(2) + ' ' + df_in['Hour'].astype(
|
||||
str).str.zfill(2) + ':' + df_in['Minute'].astype(
|
||||
str).str.zfill(2) + ':' + df_in['Second'].astype(str).str.zfill(2))
|
||||
df_in.set_index('date', inplace=True)
|
||||
|
||||
df_in.drop(columns=['Year', 'Month', 'Day', 'Hour', 'Minute', 'Second'], inplace=True)
|
||||
df_in.dropna(how='all', axis=1, inplace=True)
|
||||
|
||||
colName = df_in.columns
|
||||
df_in[colName] = df_in[colName].astype('float32')
|
||||
|
||||
# Location
|
||||
if adv_file[-9:-6] not in adv_gdfs:
|
||||
adv_gdfs[adv_file[-9:-6]] = dict()
|
||||
adv_dfs[adv_file[-9:-6]] = dict()
|
||||
# D1-6
|
||||
if adv_file[-6:-4] not in adv_gdfs[adv_file[-9:-6]]:
|
||||
adv_gdfs[adv_file[-9:-6]][adv_file[-6:-4]] = gdf_adv_locs.iloc[stationIDX]
|
||||
adv_dfs[adv_file[-9:-6]][adv_file[-6:-4]] = df_in
|
||||
else:
|
||||
adv_gdfs[adv_file[-9:-6]][adv_file[-6:-4]] = gdf_adv_locs.iloc[stationIDX]
|
||||
adv_dfs[adv_file[-9:-6]][adv_file[-6:-4]].loc[:, colName] = df_in
|
||||
|
||||
print('ADV:' + adv_file[-9:-6] +
|
||||
'; ' + adv_file[-6:-4] +
|
||||
'; var:' + adv_file[3:6])
|
||||
|
||||
# with open('ADV.pickle', 'wb') as f:
|
||||
# pickle.dump(adv_dfs, f)
|
||||
# %% Save ADV to NetCDF
|
||||
for stationIDX, stat in enumerate(adv_dfs):
|
||||
for depIDX, depdat in enumerate(adv_dfs[stat]):
|
||||
ncDat = adv_dfs[stat][depdat]
|
||||
ncDat.columns = ncDat.columns.str.replace(r"[()]", "_")
|
||||
ncDat.columns = ncDat.columns.str.replace(r"[/]", "_")
|
||||
|
||||
ncDat.to_xarray().to_netcdf(
|
||||
'C:/Users/arey/files/Projects/Newtown/DataFigs/NetCDF/ADV/' + stat + '_' + depdat + '.nc')
|
||||
|
||||
gdf_adv_locs.to_csv('C:/Users/arey/files/Projects/Newtown/DataFigs/NetCDF/ADV/ADVlocations.csv')
|
||||
|
||||
# %% Plot ADV Data
|
||||
fig, axes = plt.subplots(nrows=6, ncols=1, figsize=(9, 8))
|
||||
fig.tight_layout(pad=2)
|
||||
|
||||
for stationIDX, stat in enumerate(adv_dfs):
|
||||
for depIDX, depdat in enumerate(adv_dfs[stat]):
|
||||
|
||||
# adv_dfs[stat][depdat]['vel'].iloc[::60, :].plot(ax=axes[stationIDX])
|
||||
if 'Velocity' in adv_dfs[stat][depdat].columns:
|
||||
plotingDat = adv_dfs[stat][depdat].loc[:, 'Velocity'].resample('1s').mean()
|
||||
else:
|
||||
plotingDat = adv_dfs[stat][depdat].loc[:, 'Velocity_m_s_'].resample('1s').mean()
|
||||
|
||||
axes[stationIDX].plot(plotingDat.index, plotingDat)
|
||||
|
||||
# axes[stationIDX].set_ylim(0, 7)
|
||||
axes[stationIDX].set_xlim(pd.to_datetime("2014-07-01"), pd.to_datetime('2015-02-01'))
|
||||
# #axes[stationIDX, depIDX].format_xdata = mdates.DateFormatter('%Y-%m')
|
||||
fmt_half_year = mdates.MonthLocator(interval=1)
|
||||
axes[stationIDX].xaxis.set_major_locator(fmt_half_year)
|
||||
axes[stationIDX].xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m'))
|
||||
|
||||
|
||||
axes[stationIDX].set_title(str(stat))
|
||||
#
|
||||
axes[stationIDX].set_ylabel('ADV Velocity [m/s]')
|
||||
|
||||
# cbar.set_label('Velocity Magnitude [m/s]')
|
||||
# pltDat.set_clim([0, 0.2])
|
||||
|
||||
plt.show()
|
||||
|
||||
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/ADV_raw.png',
|
||||
bbox_inches='tight', dpi=300)
|
||||
|
||||
# %% Plot Map
|
||||
|
|
@ -516,13 +649,71 @@ mapbox = 'https://api.mapbox.com/styles/v1/alexander0042/ckemxgtk51fgp19nybfmdcb
|
|||
|
||||
fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(8, 8))
|
||||
|
||||
locTableNames = []
|
||||
locTableX = []
|
||||
locTableY = []
|
||||
|
||||
axes.set_xlim(303500, 306500)
|
||||
axes.set_ylim(61000, 63750)
|
||||
gdf.plot(ax=axes, markersize=10, color='blue', label='Mobile ADCP')
|
||||
for x, y, label in zip(gdf.drop_duplicates(subset="station", keep='last').geometry.x,
|
||||
gdf.drop_duplicates(subset="station", keep='last').geometry.y,
|
||||
gdf.drop_duplicates(subset="station", keep='last').station):
|
||||
axes.annotate(label, xy=(x, y), xytext=(20, 3), textcoords="offset points", color='blue',
|
||||
bbox=dict(boxstyle="square,pad=0.3", fc="white", ec="k", lw=0))
|
||||
|
||||
|
||||
gdf_SpringSummerDat.plot(ax=axes, markersize=12, color='magenta', label='Temperature & Salinity')
|
||||
for x, y, label in zip(gdf_SpringSummerDat.drop_duplicates(subset="loc_name", keep='last').geometry.x,
|
||||
gdf_SpringSummerDat.drop_duplicates(subset="loc_name", keep='last').geometry.y,
|
||||
gdf_SpringSummerDat.drop_duplicates(subset="loc_name", keep='last').loc_name):
|
||||
locTableNames.append(label)
|
||||
locTableX.append(x)
|
||||
locTableY.append(y)
|
||||
|
||||
gdf_moored_loc.plot(ax=axes, markersize=20, color='red', label='Moored ADCP 2012')
|
||||
for x, y, label in zip(gdf_moored_loc.drop_duplicates(subset="depCurr", keep='last').geometry.x,
|
||||
gdf_moored_loc.drop_duplicates(subset="depCurr", keep='last').geometry.y,
|
||||
gdf_moored_loc.drop_duplicates(subset="depCurr", keep='last').depCurr):
|
||||
locTableNames.append(label)
|
||||
locTableX.append(x)
|
||||
locTableY.append(y)
|
||||
|
||||
gdf_adcp2_locs.plot(ax=axes, markersize=20, color='orange', label='Moored ADCP 2014')
|
||||
gdf_gaugeLocUSSP.loc[2:3, 'geometry'].plot(ax=axes, markersize=20, color='green', label='Water Level Gauge')
|
||||
for x, y, label in zip(gdf_adcp2_locs.drop_duplicates(subset="parent_loc_code", keep='last').geometry.x,
|
||||
gdf_adcp2_locs.drop_duplicates(subset="parent_loc_code", keep='last').geometry.y,
|
||||
gdf_adcp2_locs.drop_duplicates(subset="parent_loc_code", keep='last').parent_loc_code):
|
||||
axes.annotate(label, xy=(x, y), xytext=(-65, 3), textcoords="offset points", color='orange',
|
||||
bbox=dict(boxstyle="square,pad=0.3", fc="white", ec="k", lw=0))
|
||||
locTableNames.append(label)
|
||||
locTableX.append(x)
|
||||
locTableY.append(y)
|
||||
|
||||
gdf_adv_locs.plot(ax=axes, markersize=20, color='green', label='Moored ADV 2014')
|
||||
for x, y, label in zip(gdf_adv_locs.geometry.x,
|
||||
gdf_adv_locs.geometry.y,
|
||||
gdf_adv_locs.parent_loc_code):
|
||||
axes.annotate(label, xy=(x, y), xytext=(-30, -30), textcoords="offset points", color='green',
|
||||
bbox=dict(boxstyle="square,pad=0.3", fc="white", ec="k", lw=0))
|
||||
locTableNames.append(label)
|
||||
locTableX.append(x)
|
||||
locTableY.append(y)
|
||||
|
||||
gdf_gaugeLocUSSP.loc[2:3, 'geometry'].plot(ax=axes, markersize=20, color='yellow', label='Water Level Gauge')
|
||||
for x, y, label in zip(gdf_gaugeLocUSSP.loc[2:3, 'geometry'].x,
|
||||
gdf_gaugeLocUSSP.loc[2:3, 'geometry'].y,
|
||||
gdf_gaugeLocUSSP.loc[2:3, 'Name']):
|
||||
locTableNames.append(label)
|
||||
locTableX.append(x)
|
||||
locTableY.append(y)
|
||||
|
||||
for x, y, label in zip(gdf.geometry.x,
|
||||
gdf.geometry.y,
|
||||
gdf.station + '_' + gdf.transect.astype(str) + gdf['min'].astype(str) + gdf.second.astype(str)):
|
||||
locTableNames.append(label)
|
||||
locTableX.append(x)
|
||||
locTableY.append(y)
|
||||
|
||||
|
||||
|
||||
ctx.add_basemap(axes, source=mapbox, crs='EPSG:32118')
|
||||
|
|
@ -538,5 +729,33 @@ axes.legend()
|
|||
# ctx.add_basemap(axes[1], source=mapbox, crs='EPSG:32118')
|
||||
|
||||
fig.show()
|
||||
fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/DataMap.png',
|
||||
bbox_inches='tight', dpi=300)
|
||||
# fig.savefig('C:/Users/arey/files/Projects/Newtown/DataFigs/DataMap_ADV.png',
|
||||
# bbox_inches='tight', dpi=300)
|
||||
|
||||
|
||||
# %% Import grid shapefile and find cells
|
||||
delftGrid = gp.read_file('C:/Users/arey/files/Projects/Newtown/Topology data of 2D network.shp')
|
||||
delftGrid = delftGrid.set_crs("EPSG:32118")
|
||||
delftGrid['centroid'] = delftGrid.geometry.centroid
|
||||
|
||||
obsPts = gp.GeoDataFrame(locTableNames, geometry=gp.points_from_xy(locTableX, locTableY), crs="EPSG:32118")
|
||||
|
||||
joinPTS = gp.sjoin(obsPts, delftGrid, op='within')
|
||||
|
||||
uniqueJoinPTS = joinPTS.index_right.unique()
|
||||
groupdObsLabels = joinPTS.groupby(by='index_right').agg({0:lambda x:list(x)})
|
||||
|
||||
uniqueDelftGrid = delftGrid.iloc[uniqueJoinPTS, :]
|
||||
uniqueDelftGrid['Station Names'] = groupdObsLabels
|
||||
|
||||
fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(8, 8))
|
||||
axes.set_xlim(303500, 306500)
|
||||
axes.set_ylim(61000, 63750)
|
||||
delftGrid.plot(ax=axes, markersize=10, color='gray', label='Mobile ADCP')
|
||||
delftGrid.loc[uniqueJoinPTS, 'geometry'].plot(ax=axes, markersize=10, color='blue', label='Mobile ADCP')
|
||||
ctx.add_basemap(axes, source=mapbox, crs='EPSG:32118')
|
||||
axes.set_xlabel('New York State Plane Easting [m]')
|
||||
axes.set_ylabel('New York State Plane Northing [m]')
|
||||
fig.show()
|
||||
|
||||
uniqueDelftGrid.to_excel('//srv-ott3/Projects/11934.201 Newtown Creek TPP – Privileged and Confidential/06_Models/06_Delft3DFM/RectConnect2_Obs_PTS.xlsx')
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
Loading…
Reference in New Issue