File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import tempfile
2+ import unittest
3+
4+ import xarray as xr
5+
6+ from bluemath_tk .downloaders .ecmwf .ecmwf_downloader import ECMWFDownloader
7+
8+
9+ class TestECMWFDownloader (unittest .TestCase ):
10+ def setUp (self ):
11+ self .temp_dir = tempfile .mkdtemp ()
12+ self .downloader = ECMWFDownloader (
13+ product = "OpenData" ,
14+ base_path_to_download = "OpenDataJavixu" , # self.temp_dir,
15+ check = False , # Just check paths to download, do not actually download
16+ )
17+
18+ def test_list_datasets (self ):
19+ datasets = self .downloader .list_datasets ()
20+ self .assertIsInstance (datasets , list )
21+ self .assertTrue (len (datasets ) > 0 )
22+ print (f"Available datasets: { datasets } " )
23+
24+ def test_download_data (self ):
25+ dataset = self .downloader .download_data (
26+ load_data = True ,
27+ param = ["msl" ],
28+ step = [0 , 240 ],
29+ type = "fc" ,
30+ force = False ,
31+ )
32+ self .assertIsInstance (dataset , xr .Dataset )
33+ print (dataset )
34+
35+
36+ if __name__ == "__main__" :
37+ unittest .main ()
You can’t perform that action at this time.
0 commit comments