-
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.
- Loading branch information
Showing
6 changed files
with
72 additions
and
112 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
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,24 @@ | ||
from STACpopulator.extensions.cordex6 import Cordex6DataModel | ||
|
||
|
||
def get_test_data(): | ||
import requests | ||
from siphon.catalog import TDSCatalog | ||
import xncml | ||
from STACpopulator.stac_utils import numpy_to_python_datatypes | ||
|
||
cat = TDSCatalog("https://pavics.ouranos.ca/twitcher/ows/proxy/thredds/catalog/birdhouse/disk2/ouranos/CORDEX/CMIP6/DD/NAM-12/OURANOS/MPI-ESM1-2-LR/ssp370/r1i1p1f1/CRCM5/v1-r1/day/tas/v20231208/catalog.html") | ||
|
||
if cat.datasets.items(): | ||
for item_name, ds in cat.datasets.items(): | ||
url = ds.access_urls["NCML"] | ||
r = requests.get(url) | ||
attrs = xncml.Dataset.from_text(r.text).to_cf_dict() | ||
attrs["attributes"] = numpy_to_python_datatypes(attrs["attributes"]) | ||
attrs["access_urls"] = ds.access_urls | ||
return attrs | ||
|
||
def test_item(): | ||
attrs = get_test_data() | ||
model = Cordex6DataModel.from_data(attrs) | ||
model.stac_item() |