Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run deployment workflows on ubuntu-latest #134

Merged
merged 8 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
needs: [mypy, test]
if: startsWith(github.ref, 'refs/tags')
name: Publish to PyPI (if tagged)
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Publish to TestPyPI

on:
on:
workflow_dispatch

jobs:
build-n-publish:
name: Publish to TestPyPI
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
Expand Down
10 changes: 5 additions & 5 deletions cropharvest/eo/ee_boundingbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class EEBoundingBox(BBox):
functionality
"""

def to_ee_polygon(self) -> ee.Geometry.Polygon:
return ee.Geometry.Polygon(
def to_ee_polygon(self) -> ee.Geometry:
return ee.Geometry(
[
[
[self.min_lon, self.min_lat],
Expand All @@ -38,7 +38,7 @@ def to_metres(self) -> Tuple[float, float]:

return delta_lat * m_per_deg_lat, delta_lon * m_per_deg_lon

def to_polygons(self, metres_per_patch: int = 3300) -> List[ee.Geometry.Polygon]:
def to_polygons(self, metres_per_patch: int = 3300) -> List[ee.Geometry]:
lat_metres, lon_metres = self.to_metres()

num_cols = int(lon_metres / metres_per_patch)
Expand All @@ -59,7 +59,7 @@ def to_polygons(self, metres_per_patch: int = 3300) -> List[ee.Geometry.Polygon]
lon_size = (self.max_lon - self.min_lon) / num_cols
lat_size = (self.max_lat - self.min_lat) / num_rows

output_polygons: List[ee.Geometry.Polygon] = []
output_polygons: List[ee.Geometry] = []

cur_lon = self.min_lon
while cur_lon < self.max_lon:
Expand Down Expand Up @@ -121,7 +121,7 @@ def from_centre(
return EEBoundingBox(max_lon=max_lon, min_lon=min_lon, max_lat=max_lat, min_lat=min_lat)

@staticmethod
def from_bounding_box(bounding_box: BBox, padding_metres: int) -> ee.Geometry.Polygon:
def from_bounding_box(bounding_box: BBox, padding_metres: int) -> "EEBoundingBox":
# get the mid lat, in degrees (the bounding box function returns it in radians)
mid_lat, _ = bounding_box.get_centre(in_radians=False)
m_per_deg_lat, m_per_deg_lon = EEBoundingBox.metre_per_degree(mid_lat)
Expand Down
6 changes: 3 additions & 3 deletions cropharvest/eo/eo.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _export(

def _export_for_polygon(
self,
polygon: ee.Geometry.Polygon,
polygon: ee.Geometry,
polygon_identifier: Union[int, str],
start_date: date,
end_date: date,
Expand Down Expand Up @@ -345,8 +345,8 @@ def _export_for_polygon(
@classmethod
def _labels_to_polygons_and_years(
cls, labels: geopandas.GeoDataFrame, surrounding_metres: int
) -> List[Tuple[ee.Geometry.Polygon, str, date, date]]:
output: List[ee.Geometry.Polygon] = []
) -> List[Tuple[ee.Geometry, str, date, date]]:
output: List[Tuple[ee.Geometry, str, date, date]] = []

print(f"Exporting {len(labels)} labels")

Expand Down
3 changes: 2 additions & 1 deletion cropharvest/eo/srtm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

def get_single_image(region: ee.Geometry) -> ee.Image:
elevation = ee.Image(image_collection).clip(region).select(BANDS[0])
slope = ee.Terrain.slope(elevation) # this band is already called slope
# this band is already called slope
slope = ee.Terrain.slope(elevation) # type: ignore
together = ee.Image.cat([elevation, slope]).toDouble()

return together
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-e .
black
earthengine-api>=0.1.271
mypy
mypy<=0.982
flake8
jupyter
pytest-mock
Loading
Loading