%% Make CS Points clear pointsCS load('CSpoints.mat'); % Realtime Points % Create Observation File locations = [36.606,-74.840;... 36.260,-75.594;... 36.001,-75.421;... 35.750,-75.330;... 35.025,-75.363; 36.189244, -75.739155;... 36.3205,-75.872;... 36.1656,-75.8155;... 36.0866, -75.76833;... 35.8964389,-75.6220889;... 34.7113528,-76.7368333;... 35.96176,-75.64163;... 36.04318,-75.68936;... 36.12932,-75.74501;... 36.20002, -75.7151]; locNames = {'Virginia Beach Wave',... 'Duck 26 Wave',... 'Nages Head Wave',... 'Oregon Inlet Wave',... 'Diamond Shoals Wave',... 'Duck 11 AWAC',... 'CS North',... 'CS South',... 'USGS CURRITUCK SOUND NR POINT HARBOR',... 'USGS ROANOKE SOUND AT POND ISLAND',... 'USGS BOGUE SOUND AT ATLANTIC BEACH',... 'Villa Dunes SW Dock Shoreline',... 'Hayman St Dock SW Shoreline',... 'Gunther Telephone Pole'... 'Duck 17 Wave'}; for i = 1:length(locations) pointsCS{i+11,1} = locNames{i}; [pointsCS{i+11,2},pointsCS{i+11,3}] = wgs2utm(locations(i,1),locations(i,2),18,'N'); end pointsCS{8,3} = pointsCS{8,3} + 2500; pointsCS{7,2} = pointsCS{7,2} - 500; [pointsCS{30,2},pointsCS{30,3}]= wgs2utm(34.213,-76.946,18,'N'); [pointsCS{31,2},pointsCS{31,3}]= wgs2utm(36.914,-75.720,18,'N'); pointsCS{30,1} = 'Onslow Bay Wave'; pointsCS{31,1} = 'Cape Henry Wave'; [pointsCS{32,2},pointsCS{32,3}]= wgs2utm(36.0175833,-75.6715833,18,'N'); pointsCS{32,1} = 'Kitty Hawk Airport'; [pointsCS{33,2},pointsCS{33,3}]= wgs2utm(36.20002,-75.7151,18,'N'); pointsCS{33,1} = 'FRF 17m'; pointsCS(33,4) = {'F17'}; pointsCS{10,1} = 'Currituck Sound @ Corolla'; pointsCS(1:21,4) = {'CS 1','CS 2','CS 3','CS 4','CS 5','FP','OI','HT','BF','CC','AS','VB','F26','NH','O18','DS','F11','CN','CS','PH','PI'}; pointsCS(22,4) = {'AB'}; pointsCS(23,4) = {'VD'}; pointsCS(24,4) = {'HD'}; pointsCS(25,4) = {'JC'}; pointsCS(30,4) = {'OB'}; pointsCS(31,4) = {'CH'}; pointsCS(32,4) = {'KH'}; pointsCS{27,1} = 'FRF 6m AWAC'; [pointsCS{27,2},pointsCS{27,3}]= wgs2utm(36.187328,-75.7465267,18,'N'); pointsCS{27,4} = 'F6'; pointsCS(26,4) = {'F17'}; for i = 1:length(locations) pointsCS{i+11,1} = locNames{i}; [pointsCS{i+11,2},pointsCS{i+11,3}] = wgs2utm(locations(i,1),locations(i,2),18,'N'); end pointsCS(28,:) = pointsCS(18,:); pointsCS(29,:) = pointsCS(19,:); pointsCS{28,1} = 'CS North 2'; pointsCS{29,1} = 'CS South 2'; % NDBC [pointsCS{34,2},pointsCS{34,3}] = deg2utm(36.778,-76.302); pointsCS{34,1} = 'Money Point'; [pointsCS{35,2},pointsCS{35,3}] = deg2utm(34.622,-76.525); pointsCS{35,1} = 'Cape Lookout'; [pointsCS{36,2},pointsCS{36,3}] = deg2utm(36.962,-76.424); pointsCS{36,1} = 'Dominion Terminal'; pointsCS(34,4) = {'MP'}; pointsCS(35,4) = {'CPL'}; pointsCS(36,4) = {'DV'}; % StatNum pointsCS{6,5} = 8651370; %Dck pointsCS{7,5} = 8652587; %OI pointsCS{8,5} = 8654467; %Hat pointsCS{9,5} = 8656483; %Beau pointsCS{12,5} = '44014'; %VB pointsCS{16,5} = '41025'; %DS pointsCS{30,5} = '41159'; %OB pointsCS{31,5} = '44099'; %CH pointsCS{34,5} = 'MNPV2'; %MP pointsCS{35,5} = 'CLKN7'; %CL pointsCS{36,5} = 'DOMV2'; %DV % Import Winds from NWS opts = delimitedTextImportOptions("NumVariables", 124); % Specify range and delimiter opts.DataLines = [1, Inf]; opts.Delimiter = ","; % Specify column names and types opts.VariableNames = ["STATION", "DATE", "REPORT_TYPE", "SOURCE", "AWND", "BackupDirection", "BackupDistance", "BackupDistanceUnit", "BackupElements", "BackupElevation", "BackupElevationUnit", "BackupEquipment", "BackupLatitude", "BackupLongitude", "BackupName", "CDSD", "CLDD", "DSNW", "DailyAverageDewPointTemperature", "DailyAverageDryBulbTemperature", "DailyAverageRelativeHumidity", "DailyAverageSeaLevelPressure", "DailyAverageStationPressure", "DailyAverageWetBulbTemperature", "DailyAverageWindSpeed", "DailyCoolingDegreeDays", "DailyDepartureFromNormalAverageTemperature", "DailyHeatingDegreeDays", "DailyMaximumDryBulbTemperature", "DailyMinimumDryBulbTemperature", "DailyPeakWindDirection", "DailyPeakWindSpeed", "DailyPrecipitation", "DailySnowDepth", "DailySnowfall", "DailySustainedWindDirection", "DailySustainedWindSpeed", "DailyWeather", "HDSD", "HTDD", "HeavyFog", "HourlyAltimeterSetting", "HourlyDewPointTemperature", "HourlyDryBulbTemperature", "HourlyPrecipitation", "HourlyPresentWeatherType", "HourlyPressureChange", "HourlyPressureTendency", "HourlyRelativeHumidity", "HourlySeaLevelPressure", "HourlySkyConditions", "HourlyStationPressure", "HourlyVisibility", "HourlyWetBulbTemperature", "HourlyWindDirection", "HourlyWindGustSpeed", "HourlyWindSpeed", "MonthlyAverageRH", "MonthlyDaysWithGT001Precip", "MonthlyDaysWithGT010Precip", "MonthlyDaysWithGT32Temp", "MonthlyDaysWithGT90Temp", "MonthlyDaysWithLT0Temp", "MonthlyDaysWithLT32Temp", "MonthlyDepartureFromNormalAverageTemperature", "MonthlyDepartureFromNormalCoolingDegreeDays", "MonthlyDepartureFromNormalHeatingDegreeDays", "MonthlyDepartureFromNormalMaximumTemperature", "MonthlyDepartureFromNormalMinimumTemperature", "MonthlyDepartureFromNormalPrecipitation", "MonthlyDewpointTemperature", "MonthlyGreatestPrecip", "MonthlyGreatestPrecipDate", "MonthlyGreatestSnowDepth", "MonthlyGreatestSnowDepthDate", "MonthlyGreatestSnowfall", "MonthlyGreatestSnowfallDate", "MonthlyMaxSeaLevelPressureValue", "MonthlyMaxSeaLevelPressureValueDate", "MonthlyMaxSeaLevelPressureValueTime", "MonthlyMaximumTemperature", "MonthlyMeanTemperature", "MonthlyMinSeaLevelPressureValue", "MonthlyMinSeaLevelPressureValueDate", "MonthlyMinSeaLevelPressureValueTime", "MonthlyMinimumTemperature", "MonthlySeaLevelPressure", "MonthlyStationPressure", "MonthlyTotalLiquidPrecipitation", "MonthlyTotalSnowfall", "MonthlyWetBulb", "NormalsCoolingDegreeDay", "NormalsHeatingDegreeDay", "REM", "REPORT_TYPE1", "SOURCE1", "ShortDurationEndDate005", "ShortDurationEndDate010", "ShortDurationEndDate015", "ShortDurationEndDate020", "ShortDurationEndDate030", "ShortDurationEndDate045", "ShortDurationEndDate060", "ShortDurationEndDate080", "ShortDurationEndDate100", "ShortDurationEndDate120", "ShortDurationEndDate150", "ShortDurationEndDate180", "ShortDurationPrecipitationValue005", "ShortDurationPrecipitationValue010", "ShortDurationPrecipitationValue015", "ShortDurationPrecipitationValue020", "ShortDurationPrecipitationValue030", "ShortDurationPrecipitationValue045", "ShortDurationPrecipitationValue060", "ShortDurationPrecipitationValue080", "ShortDurationPrecipitationValue100", "ShortDurationPrecipitationValue120", "ShortDurationPrecipitationValue150", "ShortDurationPrecipitationValue180", "Sunrise", "Sunset", "TStorms", "WindEquipmentChangeDate"]; opts.VariableTypes = ["string", "string", "double", "double", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "string", "string", "double", "double", "string", "string", "string", "string", "double", "double", "double", "double", "string", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "string", "double", "double", "double", "double", "double", "double", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "string", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "string", "datetime"]; opts = setvaropts(opts, 124, "InputFormat", "yyyy-MM-dd"); opts = setvaropts(opts, [2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 34, 35, 38, 39, 40, 41, 46, 58, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 123], "WhitespaceRule", "preserve"); opts = setvaropts(opts, [3, 51, 59, 60, 61, 62, 63, 64, 95, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120], "TrimNonNumeric", true); opts = setvaropts(opts, [3, 51, 59, 60, 61, 62, 63, 64, 95, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120], "ThousandsSeparator", ","); opts = setvaropts(opts, [2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 34, 35, 38, 39, 40, 41, 46, 58, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 123], "EmptyFieldRule", "auto"); opts.ExtraColumnsRule = "ignore"; opts.EmptyLineRule = "read"; % Import the data tbl = readtable("NWS.csv", opts); % Convert to output type STATION = tbl.STATION; DATE = tbl.DATE; REPORT_TYPE = tbl.REPORT_TYPE; HourlyAltimeterSetting = tbl.HourlyAltimeterSetting; HourlyPrecipitation = tbl.HourlyPrecipitation; HourlyStationPressure = tbl.HourlyStationPressure; HourlyWindDirection = tbl.HourlyWindDirection; HourlyWindGustSpeed = tbl.HourlyWindGustSpeed; HourlyWindSpeed = tbl.HourlyWindSpeed; WindEquipmentChangeDate = tbl.WindEquipmentChangeDate; WBANs = [93796 93765 93729 03737 03703 13786 13762 13763 00154 13754 03736 13766 93719 03701 13769 00370 03719 93743 03741]; % wBanList = urlreadtable('file:///D:/DorianRP/wbanmasterlist.html'); % wBanList = wBanList{1}; filename = 'lcd-stations.txt'; filename2 = 'awos-stations.txt'; filename3 = 'asos-stations.txt'; wBanList{1} = readWBAN(filename); wBanList{2} = readAWOS(filename2); wBanList{3} = readASOS(filename3); clear filename filename2 filename3 for Stat=[1:length(WBANs)] localWinds = datetime(DATE(endsWith(STATION,num2str(WBANs(Stat)))),'InputFormat','yyyy-MM-dd''T''HH:mm:ss','TimeZone','America/New_York'); localShift = tzoffset(localWinds); measuredWinds{Stat+40}(:,1) = datenum(datetime(DATE(endsWith(STATION,num2str(WBANs(Stat)))),'InputFormat','yyyy-MM-dd''T''HH:mm:ss')-localShift); measuredWinds{Stat+40}(:,2) = HourlyWindSpeed(endsWith(STATION,num2str(WBANs(Stat)))).*0.44704; measuredWinds{Stat+40}(:,3) = HourlyWindDirection(endsWith(STATION,num2str(WBANs(Stat)))); measueredPres{Stat+40}(:,1) = datenum(datetime(DATE(endsWith(STATION,num2str(WBANs(Stat)))),'InputFormat','yyyy-MM-dd''T''HH:mm:ss')-localShift); measueredPres{Stat+40}(:,2) = HourlyStationPressure(endsWith(STATION,num2str(WBANs(Stat)))).*3386.3900009071; precipUse = endsWith(STATION,num2str(WBANs(Stat)))... & REPORT_TYPE==-15 &... minute(datetime(DATE,'InputFormat','yyyy-MM-dd''T''HH:mm:ss'))>=40; clear localWinds localShift localWinds = datetime(DATE(precipUse),'InputFormat','yyyy-MM-dd''T''HH:mm:ss','TimeZone','America/New_York'); localShift = tzoffset(localWinds); measueredRain{Stat+40}(:,1) = datenum(datetime(DATE(precipUse),'InputFormat','yyyy-MM-dd''T''HH:mm:ss')-localShift); measueredRain{Stat+40}(:,2) = HourlyPrecipitation(precipUse).*0.0254*1000; measueredRain{Stat+40}(isnan(measueredRain{Stat})==1,2)=0; clear localWinds localShift precipUse wBanIDX = find(wBanList{1}.WBAN==WBANs(Stat)); wBanSource = 1; if isempty(wBanIDX)==1 wBanIDX = find(wBanList{2}.WBAN==WBANs(Stat)); wBanSource = 2; end if isempty(wBanIDX)==1 wBanIDX = find(wBanList{3}.WBAN==WBANs(Stat)); wBanSource = 3; end if isempty(wBanIDX)==1 switch Stat case 10 [pointsCS{Stat+40,2},pointsCS{Stat+40,3}] = deg2utm(34.90000,-76.88300); pointsCS{Stat+40,1} = 'CHERRY POINT'; pointsCS{Stat+40,4} = 'CP'; pointsCS{Stat+40,5} = WBANs(Stat); case 15 [pointsCS{Stat+40,2},pointsCS{Stat+40,3}] = deg2utm(36.8167,-76.0333 ); pointsCS{Stat+40,1} = 'OCEANA NAS'; pointsCS{Stat+40,4} = 'ONS'; pointsCS{Stat+40,5} = WBANs(Stat); end else wbanLat = wBanList{wBanSource}.LAT(wBanIDX); wbanLon = wBanList{wBanSource}.LON(wBanIDX); [pointsCS{Stat+40,2},pointsCS{Stat+40,3}] = deg2utm(wbanLat,wbanLon); pointsCS{Stat+40,1} = wBanList{wBanSource}.LOCATION{wBanIDX}; pointsCS{Stat+40,4} = wBanList{wBanSource}.CALL{wBanIDX}; pointsCS{Stat+40,5} = WBANs(Stat); end end pointsCS(50,4) = {'CPT'}; pointsCS{37,2} = 452000; pointsCS{37,3} = 3959200; pointsCS{37,1} = 'OI V2'; pointsCS{38,2} = 347000; pointsCS{38,3} = 3840000; pointsCS{38,1} = 'BF V2'; pointsCS{39,2} = 465400; pointsCS{39,3} = 3883600; pointsCS{39,1} = 'Hole'; pointsCS{40,2} = 390000; pointsCS{40,3} = 3930000; pointsCS{40,1} = 'Pond'; %% AHPS Stations locations = [36.060710, -75.699941;... 35.595547,-75.470031;... 35.325700,-75.511900;... 35.018333,-76.314444;... 35.024444,-76.691944; 35.435180,-76.399800;... 34.667700,-77.063400;... 35.915000,-76.722778;... 36.298611,-76.218611;... 35.537222,-76.622778;... 35.543333,-77.061944;... 36.4073,-75.9949;... 35.6841,-75.4838;... 35.9081,-75.6683;... 35.1153,-75.9873;... 35.89639,-75.62222;... 34.95630,-76.27830]; locNames = {'Albemarle Sound @ Kitty Hawk ',... 'Pamlico Sound @ Rodanthe Ferry Terminal ',... 'Pamlico Sound @ Avon ',... 'Pamlico Sound @ Cedar Island ',... 'Neuse River @ Oriental ',... 'Pamlico Sound @ Bell Island Pier ',... 'Bogue Sound @ Emerald Isle ',... 'Roanoke River @ Westover ',... 'Pasquotank River near Mariners Wharf Park @ Elizabeth City',... 'Pungo River @ Belhaven',... 'Pamlico River @ Washington',... 'Maple @ Coinjock Creek',... 'Rodanthe 6N @ New Inlet',... 'Manteo - Roanoke Marshes',... 'Coast Guard Station @ Ocracoke',... 'Roanoke Sound',... 'Lola'}; locNamesCODE = {... 'KITN7',... %7 'ROFN7',... %15 'AVON7',... %1 'CTIN7',... %None 'ORLN7',... %10 'BIPN7',... %2 'EMDN7',... %5 'WESN7',... %16 'EMWN7',... %6 'BLHN7',... %3 'PAMN7',... %11 'COJN7',... %4 'PEAN7',... %12 'RMLN7',... %14 'OCAN7',... %9 'RDFN7',... %13 'LOLN7'}; %8 locNamesID = {... 'KH',... %7 'RF',... %15 'AV',... %1 'CI',... %None 'NRO',... %10 'BI',... %2 'EI',... %5 'WO',... %16 'EC',... %6 'BH',... %3 'WH',... %11 'CJ',... %4 'NI',... %12 'RM',... %14 'OC',... %9 'RS',...%13 'LO'}; %8 %[1:7 9 11:16] for i = 1:length(locations) [pointsCS{i+59,2},pointsCS{i+59,3}] = wgs2utm(locations(i,1),locations(i,2),18,'N'); pointsCS{i+59,1} = locNames{i}; pointsCS{i+59,5} = locNamesCODE{i}; pointsCS{i+59,4} = locNamesID{i}; end % M 65 % Faves 74 62 61 60 67 69 70 % Nope 72 66 71 73 68 pointsCS{76,4} = 'LOA'; %% AWOS Pts asos = importASOS("asos.txt"); opts = delimitedTextImportOptions("NumVariables", 7); opts.DataLines = [2, Inf]; opts.Delimiter = ","; opts.VariableNames = ["stid", "station_name", "lat", "lon", "elev", "begints", "iem_network"]; opts.VariableTypes = ["string", "string", "double", "double", "double", "string", "categorical"]; opts.ExtraColumnsRule = "ignore"; opts.EmptyLineRule = "read"; opts = setvaropts(opts, ["stid", "station_name", "begints"], "WhitespaceRule", "preserve"); opts = setvaropts(opts, ["stid", "station_name", "begints", "iem_network"], "EmptyFieldRule", "auto"); % Import the data awosID = readtable("awosID.csv", opts); clear opts stationsASOS = unique(asos.station); for Stat = 1:length(stationsASOS) awosIDS = find(asos.station==stationsASOS(Stat),1); awosIDX = find(awosID.stid==cellstr(stationsASOS(Stat)),1); pointsCS(Stat+76,5) = cellstr(stationsASOS(Stat)); pointsCS(Stat+76,4) = cellstr(stationsASOS(Stat)); [pointsCS{Stat+76,2},pointsCS{Stat+76,3}] = wgs2utm(asos.lat(awosIDS),asos.lon(awosIDS),18,'N'); pointsCS(Stat+76,1) = {awosID.station_name{awosIDX}}; % pointsCS{Stat+76,1} = pointsCS{Stat+76,1}(2:end-1); end pointsCS{77,4} = 'DCG'; pointsCS{78,4} = 'ENG'; pointsCS{90,1} = 'Currituck Country Airport'; pointsCS{90,4} = 'CCA'; pointsCS{88,1} = 'Cherry Point Marine Corps Air Station'; pointsCS{88,4} = 'CPM'; pointsCS{87,4} = 'BOF'; pointsCS{86,4} = 'PIN'; pointsCS{85,1} = 'Beaufort Airport'; pointsCS{85,4} = 'BFA'; pointsCS{85,1} = 'Beaufort Airport'; pointsCS{85,4} = 'BFA'; pointsCS{84,1} = 'Manteo Dare Airport'; pointsCS{84,4} = 'MDA'; pointsCS{83,1} = 'Hatteras Airport'; pointsCS{83,4} = 'HTA'; pointsCS{82,1} = 'First flight Airport'; pointsCS{82,4} = 'FFA'; pointsCS{81,1} = 'New Berm Airport'; pointsCS{81,4} = 'NBA'; pointsCS{80,1} = 'Edenton Airport'; pointsCS{80,4} = 'EDA'; %% Add more details CSs_F = [6 7 9 22 8 11 18 10 19 20 25 24 23 21]; CSs_F = [6 7 9 22 8 11 18 10 19 20 25 24 23 21 74 60 61 67 69 70 65]; CSsH_F = [12 13 14:16 26 18 19 30 31]; CSU = [27 17 18 19]; CSM = [6 9 12 16 35 42 45 46 50 53 59]; CSM = [6 9 12 16 35 42 45 46 50 53 59 64 68 69 74 76 77:91]; CSM = [6 9 12 16 35 45 46 50 53 59 64 74 76 77 78 82:87 90]; for i = 1:length(pointsCS) if ismember(i,CSs_F) pointsCS{i,6} = 'Water Level'; end if ismember(i,CSsH_F) pointsCS{i,7} = 'Wave'; end if ismember(i,CSU) pointsCS{i,8} = 'Current'; end if ismember(i,CSM) pointsCS{i,9} = 'Wind'; end end pointsCS([6 13 17 26 27],10) = {'USACE'}; pointsCS([10 11 20:22 33],10) = {'USGS'}; pointsCS([23:25],10) = {'USACE'}; %Conery, Ian pointsCS([41:59 32],10) = {'NWS'}; %Conery, Ian pointsCS([30:31],10) = {'CDIP/ USACE'}; pointsCS([16],10) = {'NDBC'}; pointsCS([12],10) = {'NDBC/ USACE'}; pointsCS([14:15],10) = {'NDBC/ UNC'}; pointsCS([18:19],10) = {'UNC'}; pointsCS([9],10) = {'NOAA/ Duke'}; pointsCS([8],10) = {'NOAA/ USCG'}; pointsCS([7],10) = {'NOAA'}; pointsCS([34],10) = {'NDBC/ NOAA'}; pointsCS([35],10) = {'NDBC'}; pointsCS([36],10) = {'NDBC/ NOAA'}; pointsCS([60:76],10) = {'ISU/ HADS'}; pointsCS([77:91],10) = {'ISU/ ASOS'}; % pointsCS([12],7) = {'Wave (3 m Buoy)'}; pointsCS([12],11) = {'47 m'}; % pointsCS([14],7) = {'Wave (Waverider Buoy)'}; pointsCS([14],11) = {'21 m'}; % pointsCS([15],7) = {'Wave (Waverider Buoy)'}; pointsCS([15],11) = {'18 m'}; % pointsCS([16],7) = {'Wave (3 m Buoy)'}; pointsCS([16],11) = {'59 m'}; % pointsCS([30],7) = {'Wave (Datawell Buoy)'}; pointsCS([30],11) = {'30 m'}; % pointsCS([31],7) = {'Wave (Datawell Buoy)'}; pointsCS([31],11) = {'18 m'}; % pointsCS([26],7) = {'Wave (Waverider Buoy)'}; pointsCS([26],11) = {'17 m'}; pointsCS([7],1) = {'Oregon Inlet Marina'}; pointsCS([11],1) = {'Albemarle Sound @ Leonards Point'}; pointsCS([8],1) = {'Hatteras Coast Guard'}; pointsCS([9],1) = {'Beaufort Duke Marine Lab'}; pointsCS([7],1) = {'Oregon Inlet Marina'}; pointsCS([20],1) = {'Currituck Sound @ Point Harbour'}; pointsCS([21],1) = {'Roanoke Sound @ Point Island'}; pointsCS([22],1) = {'Bogue Sound @ Atlantic Beach'}; pointsCS([23],1) = {'Villa Dunes Dock'}; pointsCS([24],1) = {'Kill Devil Hills @ Hayman Street'}; pointsCS([25],1) = {'Jean Guite Creek Outlet'}; pointsCS([27],1) = {'FRF AWAC'}; pointsCS([27],11) = {'6 m'}; pointsCS([17],1) = {'FRF AWAC'}; pointsCS([17],11) = {'11 m'}; % pointsCS([17],8) = {'Current (Nortek AWAC)'}; pointsCS([14],1) = {'Nags Head Buoy'}; pointsCS([15],1) = {'Oregon Inlet Buoy'}; pointsCS([16],1) = {'Diamond Shoals Buoy'}; pointsCS([30],1) = {'Oslow Bay Buoy'}; pointsCS([31],1) = {'Cape Henry Buoy'}; pointsCS([18],1) = {'Currituck Sound North'}; pointsCS([18],11) = {'2.3 m'}; % pointsCS([18],7) = {'Wave (Nortek AWAC)'}; % pointsCS([18],8) = {'Current (Nortek Aquadopp)'}; pointsCS([19],1) = {'Currituck Sound South'}; pointsCS([19],11) = {'2.6 m'}; % pointsCS([19],7) = {'Wave (Nortek AWAC)'}; % pointsCS([19],8) = {'Current (Nortek Aquadopp)'}; % pointsCS([6],8) = {'Current (Nortek AWAC)'}; pointsCS([6],11) = {'6 m'}; pointsCS([6],1) = {'FRF Pier'}; pointsCS([26],1) = {'FRF 17 m Buoy'}; pointsCS([13],1) = {'FRF 26 m Buoy'}; pointsCS([13],11) = {'26 m'}; pointsCS([42],1) = {'Michael J Smith Field'}; pointsCS([45],1) = {'Edenton Northeast Airport'}; pointsCS([46],1) = {'Elizabth City Coast Guard'}; pointsCS([50],1) = {'Cherry Point Marine Corps Air Station'}; pointsCS([50],4) = {'CPM'}; pointsCS([53],1) = {'Coasltal Carolina Airport'}; pointsCS([59],1) = {'Warren Field Airport'}; %% Add Elevation pointsCS(41,12) = {20.85} ; pointsCS(45,12) = {6.10} ; pointsCS(46,12) = {7.5} ; pointsCS(50,12) = {8.80} ; pointsCS(50,12) = {9.90}; pointsCS(53,12) = {6.10} ; pointsCS(59,12) = {11.80}; pointsCS(64,12) = {1.40}; pointsCS(74,12) = {2}; pointsCS(76,12) = {3.74}; pointsCS(77,12) = {0.51}; pointsCS(78,12) = {0.6}; pointsCS(82,12) = {4}; pointsCS(83,12) = {3}; pointsCS(84,12) = {4}; pointsCS(85,12) = {3}; pointsCS(86,12) = {5}; pointsCS(87,12) = {3.16}; pointsCS(90,12) = {5.5}; pointsCS(35,12) = {4.6}; pointsCS(9,12) = {0}; pointsCS(12,12) = {0}; pointsCS(16,12) = {0}; pointsCS(6,12) = {11.4}; %% Adjust out of dry zone pointsCS{23,2} = pointsCS{23,2} - 100; pointsCS{32,2} = pointsCS{32,2} - 1000; pointsCS{51,2} = pointsCS{51,2} - 1000; pointsCS{62,2} = pointsCS{62,2} - 1000; pointsCS{43,2} = pointsCS{43,2} - 3000; pointsCS{72,3} = pointsCS{72,3} - 10000; pointsCS{60,2} = pointsCS{60,2} - 500; pointsCS{61,2} = pointsCS{61,2} - 900; pointsCS{61,3} = pointsCS{61,3} - 250; pointsCS{92,2} = pointsCS{60,2} + 350; pointsCS{92,3} = pointsCS{60,3} - 900; pointsCS{92,1} = [pointsCS{60,1} '_Vsouth']; pointsCS(92,4:12) = pointsCS(60,4:12); pointsCS{35,3} = pointsCS{35,3} - 2000; pointsCS{82,2} = pointsCS{82,2} - 1000; pointsCS{83,3} = pointsCS{83,3} - 1000; pointsCS{93,2} = pointsCS{22,2} + 2750; pointsCS{93,3} = pointsCS{22,3} + 100; pointsCS{93,1} = [pointsCS{22,1} '_VEast']; pointsCS(93,4:12) = pointsCS(22,4:12); pointsCS{94,2} = pointsCS{22,2} - 550; pointsCS{94,3} = pointsCS{22,3} + 250; pointsCS{94,1} = [pointsCS{22,1} '_VWest']; pointsCS(94,4:12) = pointsCS(22,4:12); pointsCS{95,2} = 350000; pointsCS{95,3} = 3977900; pointsCS{95,1} = [pointsCS{67,1} '_VEast']; pointsCS(95,4:12) = pointsCS(67,4:12); pointsCS{96,2} = 409700; pointsCS{96,3} = 3883600; pointsCS{96,1} = [pointsCS{74,1} '_VSouth']; pointsCS(96,4:12) = pointsCS(74,4:12); pointsCS{97,2} = 438200; pointsCS{97,3} = 3896000; pointsCS{97,1} = [pointsCS{24,1} '_VSouth']; pointsCS(97,4:12) = pointsCS(24,4:12); pointsCS(38,1:12) = pointsCS(9,1:12); %% DUNEX Points % Setup the Import Options and import the data opts = delimitedTextImportOptions("NumVariables", 2); % Specify range and delimiter opts.DataLines = [1, Inf]; opts.Delimiter = ","; % Specify column names and types opts.VariableNames = ["VarName1", "VarName2"]; opts.VariableTypes = ["double", "double"]; % Specify file level properties opts.ExtraColumnsRule = "ignore"; opts.EmptyLineRule = "read"; % Import the data CoordinatesBC = readtable("D:\Alexander\DUNEX\Coordinates_BC.txt", opts); % Convert to output type CoordinatesBC = table2array(CoordinatesBC); % Clear temporary variables clear opts for i = 1:length(CoordinatesBC) pointsCS{i+97,1} = ['DUNEX_' num2str(i)]; pointsCS{i+97,4} = ['D_' num2str(i)]; [pointsCS{i+97,2},pointsCS{i+97,3}] = wgs2utm(CoordinatesBC(i,2),CoordinatesBC(i,1),18,'N'); end %% Fix two bound pts [pointsCS{114,3}] = pointsCS{114,3}+400; [pointsCS{113,2}] = pointsCS{113,2}-500; % [pointsCS{113,3}] = pointsCS{113,3}+500; %% DUNEX Points clear locations locNames locNamesID locations = [36.400701, -75.823317;... 36.392170, -75.824346;... 35.779135, -75.532475;... 35.746968, -75.496067;... 35.743821, -75.500800;... 35.621202, -75.456779;... 35.620127, -75.464034;... ]; locNames = {'Currituck Banks Estuarine Reserve',... 'Currituck Banks Estuarine Reserve Nearshore',... 'Mid Oregon Inlet',... 'South Oregon Inlet',... 'South Oregon Inlet Nearshore',... 'Round Hammock Bay',... 'Round Hammock Bay Nearshore'}; locNamesID = {... 'CB',... 'CBN',... 'MI',... 'SI',... 'SIN',... 'HB',... 'HBN'}; %8 for i = 1:length(locations) [pointsCS{i+129,2},pointsCS{i+129,3}] = wgs2utm(locations(i,1),locations(i,2),18,'N'); pointsCS{i+129,1} = locNames{i}; pointsCS{i+129,4} = locNamesID{i}; end %% Add DUNEX_R R_PTS = readmatrix("D:\Alexander\DUNEX_R\R. Housego DUNEX groundwater modeling locations_AJMR.xlsx",'Sheet','Combined'); for i = 1:size(R_PTS,1) pointsCS{i+136,1} = ['DUNEX_R_' num2str(i)]; pointsCS{i+136,4} = ['DR_' num2str(i)]; [pointsCS{i+136,2},pointsCS{i+136,3}] = wgs2utm(R_PTS(i,2),R_PTS(i,1),18,'N'); end %% Add Mulligan PTS M_PTS = readcell("D:\Alexander\MulliganPTS_V2.xlsx"); for i = 1:size(M_PTS,1) pointsCS{i+160,1} = M_PTS{i,1}; pointsCS{i+160,4} = M_PTS{i,4}; [pointsCS{i+160,2},pointsCS{i+160,3}] = wgs2utm(M_PTS{i,2},M_PTS{i,3},18,'N'); end pointsCS(169,[2 3]) = pointsCS(61,[2 3]); pointsCS(164,[2 3]) = pointsCS(115,[2 3]); for i = 1:size(M_PTS,1) [webPoints(i,1),webPoints(i,2)] = utm2deg(pointsCS{i+160,2},pointsCS{i+160,3},'18 N'); end %% Add Chris PTS C_PTS = readcell("D:\Alexander\ChrisPTS.xlsx"); for i = 1:size(C_PTS,1) pointsCS{i+172,1} = ['Cpt_' C_PTS{i,1}]; pointsCS{i+172,4} = C_PTS{i,1}; [pointsCS{i+172,2},pointsCS{i+172,3}] = wgs2utm(C_PTS{i,2},C_PTS{i,3},18,'N'); end %% Add Hohonu Pts %% Check in pol pol = readPol('D:\Alexander\DUNEX\NCShoreALL.pol'); clear inPol for PolCount = 1:length(pol) for CS = 1:length(pointsCS) inPol(PolCount,CS) = inpolygon(pointsCS{CS,2},pointsCS{CS,3},pol{PolCount}(:,1),pol{PolCount}(:,2)); end end find(max(inPol)) %% Save save('D:\DUNEX_RT\Operation\DUNEX_Sept7.mat','pointsCS') %% Make Obs Files flowGrid = load('D:\Alexander\DUNEX_R\Cone7W_100.mat'); % flowGrid = load('D:\Alexander\RT_25m\C7_25.mat'); % flowGrid = load('D:\NCBathy\Cone7\C9S_50.mat') fileID=fopen('D:\Alexander\Dec28.obs','w'); % fileID=fopen('C9_50MET_V5.obs','w'); for line=1:length(pointsCS) obsIDX = NearestValue([pointsCS{line,2:3}],flowGrid.data.X,flowGrid.data.Y); if obsIDX(1) == 1 obsIDX(1) = 2; end if obsIDX(2) == 1 obsIDX(2) = 2; end if line ==71 fprintf(fileID,[num2str(line) '_' pointsCS{line,1}(1:5) ' %d %d\n'],obsIDX(1),obsIDX(2)); elseif length(pointsCS{line,1})>10 fprintf(fileID,[num2str(line) '_' pointsCS{line,1}(1:10) ' %d %d\n'],obsIDX(1),obsIDX(2)); else fprintf(fileID,[num2str(line) '_' pointsCS{line,1}(1:end) ' %d %d\n'],obsIDX(1),obsIDX(2)); end end fclose(fileID); fileID=fopen('D:\Alexander\Dec28.loc','w'); clear waveObsPts % for i = 1:40 for i = 1:length(pointsCS) obsIDX = NearestValue([pointsCS{i,2:3}],flowGrid.data.X,flowGrid.data.Y); if obsIDX(1) == 1 obsIDX(1) = 2; end if obsIDX(2) == 1 obsIDX(2) = 2; end waveObsPts(i,:) = [flowGrid.data.X(obsIDX(1),obsIDX(2)),flowGrid.data.Y(obsIDX(1),obsIDX(2))]; fprintf(fileID,' %1.7f %1.7f\n',[waveObsPts(i,1),waveObsPts(i,2)])'; end fclose(fileID) %end