-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added code search * added single code table fetch * update table fetching for codes * added codes test * run pre-commit * update docs
- Loading branch information
1 parent
ceb3033
commit 5eaa507
Showing
5 changed files
with
122 additions
and
16 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
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
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
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
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,33 @@ | ||
import pandas as pd | ||
|
||
from pyremo import codes | ||
|
||
|
||
def test_codes(): | ||
expected = { | ||
"variable": "T", | ||
"description": "temperature", | ||
"units": "K", | ||
"layer": 110.0, | ||
"time_cell_method": None, | ||
"cf_name": "ta", | ||
"code": 130, | ||
} | ||
assert codes.get_dict(130) == expected | ||
assert codes.get_dict("T") == expected | ||
|
||
|
||
def test_code_search(): | ||
df = pd.DataFrame( | ||
{ | ||
"code": 167, | ||
"variable": "TEMP2", | ||
"description": "2m temperature", | ||
"units": "K", | ||
"layer": 1.0, | ||
"time_cell_method": "mean", | ||
"cf_name": "tas", | ||
}, | ||
index=[0], | ||
) | ||
assert df.equals(codes.search(code=167).reset_index(drop=True)) |