-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Tests for `easysnowdata` package.""" | ||
|
||
|
||
import unittest | ||
|
||
from easysnowdata import automatic_weather_stations | ||
import pandas as pd | ||
import geopandas as gpd | ||
|
||
|
||
class TestAutomaticWeatherStations(unittest.TestCase): | ||
"""Tests for `easysnowdata` package.""" | ||
|
||
@classmethod | ||
def setUpClass(self): | ||
"""Set up test fixtures, if any.""" | ||
bbox_gdf = gpd.read_file('https://github.com/egagli/sar_snowmelt_timing/raw/main/input/shapefiles/mt_rainier.geojson') | ||
self.StationCollectionSNOTEL = automatic_weather_stations.StationCollection(snotel_stations=True, ccss_stations=False) | ||
self.StationCollectionCCSS = automatic_weather_stations.StationCollection(snotel_stations=False, ccss_stations=True) | ||
self.StationCollectionAll = automatic_weather_stations.StationCollection(snotel_stations=True, ccss_stations=True) | ||
self.StationCollectionAllOrdered = automatic_weather_stations.StationCollection(snotel_stations=True, ccss_stations=False, sortby_dist_to_geom=bbox_gdf) | ||
|
||
@classmethod | ||
def tearDownClass(self): | ||
"""Tear down test fixtures, if any.""" | ||
self.StationCollectionSNOTEL = None | ||
self.StationCollectionCCSS = None | ||
self.StationCollectionAll = None | ||
self.StationCollectionAllOrdered = None | ||
|
||
|
||
def test_get_all_stations(self): | ||
"""Test get_all_stations method in automatic_weather_stations class.""" | ||
self.StationCollection.get_all_stations() | ||
self.assertIsInstance(self.StationCollectionAll.stations, gpd.GeoDataFrame) | ||
self.assertGreater(len(self.StationCollectionAll.stations), 960) | ||
|
||
def test_choose_station(self): | ||
"""Test choose_station method in automatic_weather_stations class.""" | ||
self.StationCollection.choose_station() | ||
self.assertIsInstance(self.StationCollection.station, dict) | ||
|
||
def test_get_data(self): | ||
"""Test get_data method in automatic_weather_stations class.""" | ||
|
||
self.StationCollection.get_data() | ||
self.assertIsInstance(self.StationCollection.data, pd.DataFrame) | ||
|
||
def test_get_single_station_data(self): | ||
"""Test get_single_station_data method in automatic_weather_stations class.""" | ||
self.StationCollection.get_single_station_data() | ||
self.assertIsInstance(self.StationCollection.data, pd.DataFrame) | ||
|
||
def test_multiple_station_data(self): | ||
"""Test multiple_station_data method in automatic_weather_stations class.""" | ||
self.StationCollection.multiple_station_data() | ||
self.assertIsInstance(self.StationCollection.data, pd.DataFrame) | ||
|
||
def test_get_entire_data_archive(self): | ||
"""Test get_entire_data_archive method in automatic_weather_stations class.""" | ||
self.StationCollection.get_entire_data_archive() | ||
self.assertIsInstance(self.StationCollection.data, pd.DataFrame) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Tests for `easysnowdata` package.""" | ||
|
||
|
||
import unittest | ||
|
||
from easysnowdata import easysnowdata | ||
|
||
|
||
class TestEasysnowdata(unittest.TestCase): | ||
"""Tests for `easysnowdata` package.""" | ||
|
||
def setUp(self): | ||
"""Set up test fixtures, if any.""" | ||
|
||
def tearDown(self): | ||
"""Tear down test fixtures, if any.""" | ||
|
||
def test_000_something(self): | ||
"""Test something.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Tests for `easysnowdata` package.""" | ||
|
||
|
||
import unittest | ||
|
||
from easysnowdata import easysnowdata | ||
|
||
|
||
class TestEasysnowdata(unittest.TestCase): | ||
"""Tests for `easysnowdata` package.""" | ||
|
||
def setUp(self): | ||
"""Set up test fixtures, if any.""" | ||
|
||
def tearDown(self): | ||
"""Tear down test fixtures, if any.""" | ||
|
||
def test_000_something(self): | ||
"""Test something.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Tests for `easysnowdata` package.""" | ||
|
||
|
||
import unittest | ||
|
||
from easysnowdata import easysnowdata | ||
|
||
|
||
class TestEasysnowdata(unittest.TestCase): | ||
"""Tests for `easysnowdata` package.""" | ||
|
||
def setUp(self): | ||
"""Set up test fixtures, if any.""" | ||
|
||
def tearDown(self): | ||
"""Tear down test fixtures, if any.""" | ||
|
||
def test_000_something(self): | ||
"""Test something.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Tests for `easysnowdata` package.""" | ||
|
||
|
||
import unittest | ||
|
||
from easysnowdata import easysnowdata | ||
|
||
|
||
class TestEasysnowdata(unittest.TestCase): | ||
"""Tests for `easysnowdata` package.""" | ||
|
||
def setUp(self): | ||
"""Set up test fixtures, if any.""" | ||
|
||
def tearDown(self): | ||
"""Tear down test fixtures, if any.""" | ||
|
||
def test_000_something(self): | ||
"""Test something.""" |