Skip to content

Commit 0ce368d

Browse files
akeestessolson
andauthored
Metocean module - WIND Toolkit (#187)
* initial script * update wind_toolkit with 4 regions and 1-hr or 5-min data * update parameters of wind_toolkit functions * compare NDBC and WIND metocean data * fix typo in wpto hindcast example * finish metocean example and add results * add wind_toolkit to wave/io/__init__.py * update WIND Toolkit parameter list * initial test structure for WIND toolkit * finish metocean example * add function to plot each region * wind toolkit tests and test data * add tests for misc wind_toolkit MHKiT functions and cases * fix wind toolkit tests * add elevation_to_string utility function * misc cleanup * clarify available parameters * add users lat_lon to plot_region visualization * update example with new functions * add numpy dependency back in * Ingnore the new hindcast folder * Include only the new hindcast folder * Move hindcast tests to hindcast folder * Specify exclusion of hindcast from standard coverage * update hindcast coverage * remove unnecessary header * move hindcast and wind_toolkit to wave/io/hindcast * update .coveragerc files * update paths for new wave.io.hindcast directory Co-authored-by: ssolson <[email protected]>
1 parent fbcf0ff commit 0ce368d

19 files changed

+35915
-364
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
[run]
22
include =
3-
./mhkit/wave/io/hindcast.py
3+
./mhkit/wave/io/hindcast/hindcast.py
4+
./mhkit/wave/io/hindcast/wind_toolkit.py
45

56
[report]
67
include =
7-
./mhkit/wave/io/hindcast.py
8+
./mhkit/wave/io/hindcast/hindcast.py
9+
./mhkit/wave/io/hindcast/wind_toolkit.py
10+

.github/workflows/.coveragerc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
[run]
22
omit =
3-
# omit everything in tests and /wave
3+
# omit everything in tests and hindcast functions
44
./mhkit/tests/*
5-
./mhkit/wave/io/hindcast.py
5+
./mhkit/wave/io/hindcast/hindcast.py
6+
./mhkit/wave/io/hindcast/wind_toolkit.py
67

78
[report]
89
omit =
9-
# omit everything in tests and /wave
10+
# omit everything in tests and hindcast functions
1011
./mhkit/tests/*
11-
./mhkit/wave/io/hindcast.py
12+
./mhkit/wave/io/hindcast/hindcast.py
13+
./mhkit/wave/io/hindcast/wind_toolkit.py
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
addopts = ./mhkit/tests/wave/io/test_hindcast.py
2+
addopts = ./mhkit/tests/wave/io/hindcast

.github/workflows/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[pytest]
2-
addopts = --ignore=./mhkit/tests/wave/io/test_hindcast.py
2+
addopts = --ignore=./mhkit/tests/wave/io/hindcast

examples/WPTO_hindcast_example.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
],
103103
"source": [
104104
"lat_lon = [44.624076,-124.280097]\n",
105-
"region = wave.io.hindcast.region_selection(lat_lon)\n",
105+
"region = wave.io.hindcast.hindcast.region_selection(lat_lon)\n",
106106
"print(region)"
107107
]
108108
},
@@ -112,7 +112,7 @@
112112
"source": [
113113
"### 2. Download WPTO Hindcast Data from a Single Location\n",
114114
"\n",
115-
"In this example we will request 3-hour significant wave height for 1995 at the point (44.624076,-124.280097, near the PacWave site). We will speficy each of these as a variable and pass them to the wave IO hindacast function `request_wpto_dataset`. The data type will be a high-spatial-resolution dataset, year(s) will be 1995, latitude/longitude pairs will be for a point near PacWave, and the parameter will be significant wave height."
115+
"In this example we will request 3-hour significant wave height for 1995 at the point (44.624076,-124.280097, near the PacWave site). We will speficy each of these as a variable and pass them to the wave IO hindcast function `request_wpto_dataset`. The data type will be a high-spatial-resolution dataset, year(s) will be 1995, latitude/longitude pairs will be for a point near PacWave, and the parameter will be significant wave height."
116116
]
117117
},
118118
{
@@ -126,7 +126,7 @@
126126
"lat_lon = (44.624076,-124.280097) \n",
127127
"parameter = 'significant_wave_height' \n",
128128
"\n",
129-
"Hs, metadata= wave.io.hindcast.request_wpto_point_data(data_type,parameter,lat_lon,years)"
129+
"Hs, metadata= wave.io.hindcast.hindcast.request_wpto_point_data(data_type,parameter,lat_lon,years)"
130130
]
131131
},
132132
{
@@ -206,7 +206,7 @@
206206
"cell_type": "markdown",
207207
"metadata": {},
208208
"source": [
209-
"#### Hindacast Data Returned \n",
209+
"#### Hindcast Data Returned \n",
210210
"\n",
211211
"We can also take a look at the first 5 rows of the returned data by call the `head()` method on the returned data. By calling this below we can see that the returned data has a time index and a single column of significant wave height. The siginifcant wave height column has a 0 integer on the end of it refering to the index in the metadata. In out next example the importance of this integer will become more clear as we begin to request multiple locations."
212212
]
@@ -382,7 +382,7 @@
382382
"lat_lon = ((44.624076,-124.280097),\n",
383383
" (43.489171,-125.152137)) \n",
384384
"\n",
385-
"Te, metadata = wave.io.hindcast.request_wpto_point_data(data_type, parameter, lat_lon, years)\n",
385+
"Te, metadata = wave.io.hindcast.hindcast.request_wpto_point_data(data_type, parameter, lat_lon, years)\n",
386386
"\n",
387387
"# View Te from two locations\n",
388388
"Te.head()"
@@ -586,7 +586,7 @@
586586
"parameter = 'omni-directional_wave_power'\n",
587587
"lat_lon = (44.624076,-124.280097) \n",
588588
"\n",
589-
"J, metadata= wave.io.hindcast.request_wpto_point_data(data_type,parameter,lat_lon,years) \n",
589+
"J, metadata= wave.io.hindcast.hindcast.request_wpto_point_data(data_type,parameter,lat_lon,years) \n",
590590
"\n",
591591
"J"
592592
]
@@ -675,7 +675,7 @@
675675
"parameter = ['significant_wave_height','peak_period','mean_wave_direction']\n",
676676
"lat_lon = (44.624076,-124.280097) \n",
677677
"\n",
678-
"data, metadata= wave.io.hindcast.request_wpto_point_data(data_type,parameter,lat_lon,years) "
678+
"data, metadata= wave.io.hindcast.hindcast.request_wpto_point_data(data_type,parameter,lat_lon,years) "
679679
]
680680
},
681681
{
@@ -1907,7 +1907,7 @@
19071907
"source": [
19081908
"year = '1993' # only one year can be passed at a time as a string\n",
19091909
"lat_lon=(43.489171,-125.152137)\n",
1910-
"dir_spectra,meta = wave.io.hindcast.request_wpto_directional_spectrum(lat_lon,year)\n",
1910+
"dir_spectra,meta = wave.io.hindcast.hindcast.request_wpto_directional_spectrum(lat_lon,year)\n",
19111911
"\n",
19121912
"print(dir_spectra)"
19131913
]

0 commit comments

Comments
 (0)