-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from digitalearthpacific/update-tweak-for-geomad
Update tweak for geomad
- Loading branch information
Showing
6 changed files
with
163 additions
and
31 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 |
---|---|---|
|
@@ -127,3 +127,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Ignore cached geopackage files | ||
*.gpkg |
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,31 @@ | ||
from dep_tools.grids import get_tiles, _get_gadm, PACIFIC_EPSG | ||
from json import loads | ||
|
||
from odc.geo import Geometry | ||
|
||
def test_get_gadm(): | ||
all = _get_gadm() | ||
assert len(all) == 22 | ||
|
||
# Convert to a ODC Geometry | ||
geom = Geometry(loads(all.to_json()), crs=all.crs) | ||
assert geom.crs == 4326 | ||
|
||
|
||
def test_get_tiles(): | ||
# This takes 2 minutes to retrieve all the tiles. Keep it as a generator. | ||
print("a") | ||
tiles = get_tiles(resolution=30) | ||
|
||
# Let's just check one | ||
# Each item in the generator is a tuple with the tile index and the geobox object | ||
tile, geobox = next(tiles) | ||
assert type(tile) is tuple | ||
assert geobox.crs == PACIFIC_EPSG | ||
|
||
print("b") | ||
# Check the count here, shouldn't take too long | ||
tiles = list(get_tiles(resolution=30, country_codes=["FJI"])) | ||
assert len(tiles) == 27 | ||
|
||
print("c") |