From 21b3d15ce2f1bc71f67050bfd743babe5acbba5a Mon Sep 17 00:00:00 2001 From: Kenn Cartier Date: Wed, 18 Dec 2024 23:38:45 -0800 Subject: [PATCH] re-added imports --- city_metrix/layers/albedo.py | 5 ++++- city_metrix/layers/alos_dsm.py | 3 +++ city_metrix/layers/average_net_building_height.py | 5 ++++- city_metrix/layers/built_up_height.py | 5 ++++- city_metrix/layers/esa_world_cover.py | 6 ++++-- city_metrix/layers/glad_lulc.py | 2 +- city_metrix/layers/high_land_surface_temperature.py | 8 ++++---- city_metrix/layers/impervious_surface.py | 5 ++++- city_metrix/layers/land_surface_temperature.py | 6 ++++-- city_metrix/layers/layer.py | 1 + city_metrix/layers/nasa_dem.py | 2 ++ city_metrix/layers/natural_areas.py | 1 + city_metrix/layers/smart_surface_lulc.py | 2 ++ city_metrix/layers/tree_canopy_height.py | 4 ++++ city_metrix/layers/tree_cover.py | 4 ++++ city_metrix/layers/urban_land_use.py | 3 +++ city_metrix/layers/world_pop.py | 3 +++ 17 files changed, 52 insertions(+), 13 deletions(-) diff --git a/city_metrix/layers/albedo.py b/city_metrix/layers/albedo.py index dc1780a..ea7ae6e 100644 --- a/city_metrix/layers/albedo.py +++ b/city_metrix/layers/albedo.py @@ -1,6 +1,9 @@ import ee +import xarray +from dask.diagnostics import ProgressBar + +from .layer import Layer, get_utm_zone_epsg, get_image_collection -from .layer import Layer, get_image_collection class Albedo(Layer): """ diff --git a/city_metrix/layers/alos_dsm.py b/city_metrix/layers/alos_dsm.py index c22df82..0fc470b 100644 --- a/city_metrix/layers/alos_dsm.py +++ b/city_metrix/layers/alos_dsm.py @@ -1,4 +1,7 @@ import ee +import xee +import xarray as xr + from .layer import Layer, get_image_collection diff --git a/city_metrix/layers/average_net_building_height.py b/city_metrix/layers/average_net_building_height.py index 11799cc..2e26018 100644 --- a/city_metrix/layers/average_net_building_height.py +++ b/city_metrix/layers/average_net_building_height.py @@ -1,6 +1,9 @@ +from dask.diagnostics import ProgressBar +import xarray as xr +import xee import ee -from .layer import Layer, get_image_collection +from .layer import Layer, get_utm_zone_epsg, get_image_collection class AverageNetBuildingHeight(Layer): diff --git a/city_metrix/layers/built_up_height.py b/city_metrix/layers/built_up_height.py index aef268e..b04399d 100644 --- a/city_metrix/layers/built_up_height.py +++ b/city_metrix/layers/built_up_height.py @@ -1,6 +1,9 @@ +from dask.diagnostics import ProgressBar +import xarray as xr +import xee import ee -from .layer import Layer, get_image_collection +from .layer import Layer, get_utm_zone_epsg, get_image_collection class BuiltUpHeight(Layer): diff --git a/city_metrix/layers/esa_world_cover.py b/city_metrix/layers/esa_world_cover.py index c214781..7e20c31 100644 --- a/city_metrix/layers/esa_world_cover.py +++ b/city_metrix/layers/esa_world_cover.py @@ -1,7 +1,9 @@ +from dask.diagnostics import ProgressBar +from enum import Enum +import xarray as xr import ee -from enum import Enum -from .layer import Layer, get_image_collection +from .layer import Layer, get_utm_zone_epsg, get_image_collection class EsaWorldCoverClass(Enum): diff --git a/city_metrix/layers/glad_lulc.py b/city_metrix/layers/glad_lulc.py index 11afe31..da29076 100644 --- a/city_metrix/layers/glad_lulc.py +++ b/city_metrix/layers/glad_lulc.py @@ -1,7 +1,7 @@ import xarray as xr import ee -from .layer import Layer, get_image_collection +from .layer import Layer, get_utm_zone_epsg, get_image_collection class LandCoverGlad(Layer): diff --git a/city_metrix/layers/high_land_surface_temperature.py b/city_metrix/layers/high_land_surface_temperature.py index 9cbf5ea..670db62 100644 --- a/city_metrix/layers/high_land_surface_temperature.py +++ b/city_metrix/layers/high_land_surface_temperature.py @@ -1,9 +1,9 @@ -import datetime -import ee - -from shapely.geometry import box +from .landsat_collection_2 import LandsatCollection2 from .land_surface_temperature import LandSurfaceTemperature from .layer import Layer +from shapely.geometry import box +import datetime +import ee class HighLandSurfaceTemperature(Layer): """ diff --git a/city_metrix/layers/impervious_surface.py b/city_metrix/layers/impervious_surface.py index 9cf017d..da45159 100644 --- a/city_metrix/layers/impervious_surface.py +++ b/city_metrix/layers/impervious_surface.py @@ -1,6 +1,9 @@ +from dask.diagnostics import ProgressBar +import xarray as xr +import xee import ee -from .layer import Layer, get_image_collection +from .layer import Layer, get_utm_zone_epsg, get_image_collection class ImperviousSurface(Layer): diff --git a/city_metrix/layers/land_surface_temperature.py b/city_metrix/layers/land_surface_temperature.py index 93888ce..48a66e6 100644 --- a/city_metrix/layers/land_surface_temperature.py +++ b/city_metrix/layers/land_surface_temperature.py @@ -1,6 +1,8 @@ +from .landsat_collection_2 import LandsatCollection2 +from .layer import Layer, get_utm_zone_epsg, get_image_collection +from dask.diagnostics import ProgressBar import ee - -from .layer import Layer, get_image_collection +import xarray class LandSurfaceTemperature(Layer): """ diff --git a/city_metrix/layers/layer.py b/city_metrix/layers/layer.py index 91e6316..211ecac 100644 --- a/city_metrix/layers/layer.py +++ b/city_metrix/layers/layer.py @@ -2,6 +2,7 @@ from abc import abstractmethod from typing import Union, Tuple from uuid import uuid4 +# This osgeo import is essential for proper functioning. Do not remove. from osgeo import gdal import ee diff --git a/city_metrix/layers/nasa_dem.py b/city_metrix/layers/nasa_dem.py index 72623a9..4f08d4e 100644 --- a/city_metrix/layers/nasa_dem.py +++ b/city_metrix/layers/nasa_dem.py @@ -1,4 +1,6 @@ import ee +import xee +import xarray as xr from .layer import Layer, get_image_collection diff --git a/city_metrix/layers/natural_areas.py b/city_metrix/layers/natural_areas.py index fdf499b..092a30c 100644 --- a/city_metrix/layers/natural_areas.py +++ b/city_metrix/layers/natural_areas.py @@ -1,3 +1,4 @@ +import xarray as xr from xrspatial.classify import reclassify from .layer import Layer diff --git a/city_metrix/layers/smart_surface_lulc.py b/city_metrix/layers/smart_surface_lulc.py index 2e0f083..c8e0582 100644 --- a/city_metrix/layers/smart_surface_lulc.py +++ b/city_metrix/layers/smart_surface_lulc.py @@ -1,7 +1,9 @@ import xarray as xr import numpy as np import pandas as pd +import geopandas as gpd from shapely.geometry import CAP_STYLE, JOIN_STYLE +from shapely.geometry import box from exactextract import exact_extract from geocube.api.core import make_geocube import warnings diff --git a/city_metrix/layers/tree_canopy_height.py b/city_metrix/layers/tree_canopy_height.py index f499552..2acca4a 100644 --- a/city_metrix/layers/tree_canopy_height.py +++ b/city_metrix/layers/tree_canopy_height.py @@ -1,3 +1,7 @@ +from .layer import Layer, get_utm_zone_epsg, get_image_collection +from dask.diagnostics import ProgressBar +import xarray as xr +import xee import ee from .layer import Layer, get_image_collection diff --git a/city_metrix/layers/tree_cover.py b/city_metrix/layers/tree_cover.py index 52fc8d6..1b58cf3 100644 --- a/city_metrix/layers/tree_cover.py +++ b/city_metrix/layers/tree_cover.py @@ -1,3 +1,7 @@ +from .layer import Layer, get_utm_zone_epsg, get_image_collection +from dask.diagnostics import ProgressBar +import xarray as xr +import xee import ee from .layer import Layer, get_image_collection diff --git a/city_metrix/layers/urban_land_use.py b/city_metrix/layers/urban_land_use.py index 02c737c..708ba32 100644 --- a/city_metrix/layers/urban_land_use.py +++ b/city_metrix/layers/urban_land_use.py @@ -1,3 +1,6 @@ +from dask.diagnostics import ProgressBar +import xarray as xr +import xee import ee from .layer import Layer, get_image_collection diff --git a/city_metrix/layers/world_pop.py b/city_metrix/layers/world_pop.py index 700010a..b177ab1 100644 --- a/city_metrix/layers/world_pop.py +++ b/city_metrix/layers/world_pop.py @@ -1,3 +1,6 @@ +from dask.diagnostics import ProgressBar +import xarray as xr +import xee import ee from .layer import Layer, get_image_collection