ChHarding / TouchTerrain_jupyter_docker

Image for running Touchterrain standalone via a jupyter notebook
15 stars 4 forks source link

Error generating STL #12

Open michaelmisiaszek opened 1 week ago

michaelmisiaszek commented 1 week ago

Hi, I have been using the online version and could not get the app to read from a Google drive (kml file), so I saw this docker container and decided to try it out. I'm not new to docker and run containers daily. However, I am very new to python and such, but the workbooks seem really cool. Nonetheless, I'm getting an error when I run this app in my container through the starters binder. I have no idea what any of it means, so I thought I'd shoot you the log and take a peek:

Log for creating 3D model tile(s) for  10m_-118.94_48.16 

DEM_name = USGS/3DEP/10m 
trlat = 48.493385425999996 
trlon = -118.08383648099999 
bllat = 47.817673574000004 
bllon = -119.787156819 
printres = 0.4 
ntilesx = 1 
ntilesy = 1 
tilewidth = 120 
basethick = 0 
zscale = 1.5 
fileformat = STLb 
no_bottom = False 
lower_leq = [0, 3] 
unprojected = False 
no_normals = True 

process started: 08:39:12.996824 

Region (lat/lon):
   48.493385425999996 -118.08383648099999 (top right)
   47.817673574000004 -119.787156819 (bottom left) 
center at [-118.93549665, 48.1555295]  UTM 11 N ,  EPSG:32611 
lon/lat size in degrees: [1.7033203380000117, 0.6757118519999921] 
requesting 422.4276894135149 m resolution from EarthEngine

---------------------------------------------------------------------------
EEException                               Traceback (most recent call last)
Cell In[16], line 2
      1 # create zipfile under tmp with the STL file of the terrain model
----> 2 totalsize, full_zip_file_name = TouchTerrain.get_zipped_tiles(**args) 
      3 print("Created zip file", full_zip_file_name,  "%.2f" % totalsize, "Mb")

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainEarthEngine.py:854, in get_zipped_tiles(DEM_name, trlat, trlon, bllat, bllon, polygon, polyURL, poly_file, importedDEM, printres, ntilesx, ntilesy, tilewidth, basethick, zscale, fileformat, tile_centered, CPU_cores_to_use, max_cells_for_memory_only, temp_folder, zip_file_name, no_bottom, bottom_image, ignore_leq, lower_leq, unprojected, only, original_query_string, no_normals, projection, use_geo_coords, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, map_img_filename, smooth_borders, offset_masks_lower, fill_holes, min_elev, tilewidth_scale, clean_diags, sqrt, **otherargs)
    852     image1 = elev.mosaic().setDefaultProjection(proj) # must mosaic collection into single image
    853 else:
--> 854     image1 = ee.Image(DEM_name)
    855     info = image1.getInfo() 
    858 pr("Earth Engine raster:", info["id"])

File /usr/local/lib/python3.10/site-packages/ee/computedobject.py:32, in ComputedObjectMetaclass.__call__(cls, *args, **kwargs)
     30   return args[0]
     31 else:
---> 32   return type.__call__(cls, *args, **kwargs)

File /usr/local/lib/python3.10/site-packages/ee/image.py:56, in Image.__init__(self, args, version)
     38 def __init__(self, args=None, version=None):
     39   """Constructs an Earth Engine image.
     40 
     41   Args:
   (...)
     54     EEException: if passed something other than the above.
     55   """
---> 56   self.initialize()
     58   if version is not None:
     59     if ee_types.isString(args) and ee_types.isNumber(version):
     60       # An ID and version.

File /usr/local/lib/python3.10/site-packages/ee/image.py:102, in Image.initialize(cls)
    100 """Imports API functions to this class."""
    101 if not cls._initialized:
--> 102   apifunction.ApiFunction.importApi(cls, 'Image', 'Image')
    103   cls._initialized = True

File /usr/local/lib/python3.10/site-packages/ee/apifunction.py:183, in ApiFunction.importApi(cls, target, prefix, type_name, opt_prepend)
    170 @classmethod
    171 def importApi(cls, target, prefix, type_name, opt_prepend=None):
    172   """Adds all API functions that begin with a given prefix to a target class.
    173 
    174   Args:
   (...)
    181         added functions.
    182   """
--> 183   cls.initialize()
    184   prepend = opt_prepend or ''
    185   for name, api_func in cls._api.items():

File /usr/local/lib/python3.10/site-packages/ee/apifunction.py:154, in ApiFunction.initialize(cls)
    152 """Initializes the list of signatures from the Earth Engine front-end."""
    153 if not cls._api:
--> 154   signatures = data.getAlgorithms()
    155   api = {}
    156   for name, sig in signatures.items():
    157     # Strip type parameters.

File /usr/local/lib/python3.10/site-packages/ee/data.py:1109, in getAlgorithms()
   1093 """Get the list of algorithms.
   1094 
   1095 Returns:
   (...)
   1106               is not specified.
   1107 """
   1108 try:
-> 1109   call = _get_cloud_api_resource().projects().algorithms().list(
   1110       parent=_get_projects_path(), prettyPrint=False)
   1111 except TypeError:
   1112   call = _get_cloud_api_resource().projects().algorithms().list(
   1113       project=_get_projects_path(), prettyPrint=False)

File /usr/local/lib/python3.10/site-packages/ee/data.py:282, in _get_cloud_api_resource()
    280 def _get_cloud_api_resource():
    281   if _cloud_api_resource is None:
--> 282     raise ee_exception.EEException(
    283         'Earth Engine client library not initialized. Run `ee.Initialize()`')
    284   return _cloud_api_resource

EEException: Earth Engine client library not initialized. Run `ee.Initialize()`
ChHarding commented 1 day ago

Hi,

Correct, the web app needs you to upload a local KML file. But have you tried downloading the kml file from your google drive and uploading it to the web app?

Re your error, this is b/c the notebook needs to initialize the Earth engine package ee.Initialize(). This should have happened in the cell titled Importing Python Packages when TouchTerrainEarthEngine get imported. As it seem that you’re using Earth engine you will have to authenticate with your google account first. There’s some info in the file EarthEngine_authentication_guide.md in my Touchterrain repo, but Google recently changed their process. I think I ‘ve figured out how to make it work but I need to update the guide for this and also update the Jupiter notebooks. I’ll be happy to ping you once that has happend, OK? BTW you should be using the for_starters notebook, not the binder one.

Cheers

Chris

On Jun 22, 2024, at 03:50, michaelmisiaszek @.***> wrote:

Hi, I have been using the online version and could not get the app to read from a Google drive (kml file), so I saw this docker container and decided to try it out. I'm not new to docker and run containers daily. However, I am very new to python and such, but the workbooks seem really cool. Nonetheless, I'm getting an error when I run this app in my container through the starters binder. I have no idea what any of it means, so I thought I'd shoot you the log and take a peek:

Log for creating 3D model tile(s) for 10m_-118.94_48.16

DEM_name = USGS/3DEP/10m trlat = 48.493385425999996 trlon = -118.08383648099999 bllat = 47.817673574000004 bllon = -119.787156819 printres = 0.4 ntilesx = 1 ntilesy = 1 tilewidth = 120 basethick = 0 zscale = 1.5 fileformat = STLb no_bottom = False lower_leq = [0, 3] unprojected = False no_normals = True

process started: 08:39:12.996824

Region (lat/lon): 48.493385425999996 -118.08383648099999 (top right) 47.817673574000004 -119.787156819 (bottom left) center at [-118.93549665, 48.1555295] UTM 11 N , EPSG:32611 lon/lat size in degrees: [1.7033203380000117, 0.6757118519999921] requesting 422.4276894135149 m resolution from EarthEngine


EEException Traceback (most recent call last) Cell In[16], line 2 1 # create zipfile under tmp with the STL file of the terrain model ----> 2 totalsize, full_zip_file_name = TouchTerrain.get_zipped_tiles(**args) 3 print("Created zip file", full_zip_file_name, "%.2f" % totalsize, "Mb")

File /TouchTerrain/standalone/touchterrain/common/TouchTerrainEarthEngine.py:854, in get_zipped_tiles(DEM_name, trlat, trlon, bllat, bllon, polygon, polyURL, poly_file, importedDEM, printres, ntilesx, ntilesy, tilewidth, basethick, zscale, fileformat, tile_centered, CPU_cores_to_use, max_cells_for_memory_only, temp_folder, zip_file_name, no_bottom, bottom_image, ignore_leq, lower_leq, unprojected, only, original_query_string, no_normals, projection, use_geo_coords, importedGPX, gpxPathHeight, gpxPixelsBetweenPoints, gpxPathThickness, map_img_filename, smooth_borders, offset_masks_lower, fill_holes, min_elev, tilewidth_scale, clean_diags, sqrt, **otherargs) 852 image1 = elev.mosaic().setDefaultProjection(proj) # must mosaic collection into single image 853 else: --> 854 image1 = ee.Image(DEM_name) 855 info = image1.getInfo() 858 pr("Earth Engine raster:", info["id"])

File /usr/local/lib/python3.10/site-packages/ee/computedobject.py:32, in ComputedObjectMetaclass.call(cls, *args, *kwargs) 30 return args[0] 31 else: ---> 32 return type.call(cls, args, **kwargs)

File /usr/local/lib/python3.10/site-packages/ee/image.py:56, in Image.init(self, args, version) 38 def init(self, args=None, version=None): 39 """Constructs an Earth Engine image. 40 41 Args: (...) 54 EEException: if passed something other than the above. 55 """ ---> 56 self.initialize() 58 if version is not None: 59 if ee_types.isString(args) and ee_types.isNumber(version): 60 # An ID and version.

File /usr/local/lib/python3.10/site-packages/ee/image.py:102, in Image.initialize(cls) 100 """Imports API functions to this class.""" 101 if not cls._initialized: --> 102 apifunction.ApiFunction.importApi(cls, 'Image', 'Image') 103 cls._initialized = True

File /usr/local/lib/python3.10/site-packages/ee/apifunction.py:183, in ApiFunction.importApi(cls, target, prefix, type_name, opt_prepend) 170 @classmethod 171 def importApi(cls, target, prefix, type_name, opt_prepend=None): 172 """Adds all API functions that begin with a given prefix to a target class. 173 174 Args: (...) 181 added functions. 182 """ --> 183 cls.initialize() 184 prepend = opt_prepend or '' 185 for name, api_func in cls._api.items():

File /usr/local/lib/python3.10/site-packages/ee/apifunction.py:154, in ApiFunction.initialize(cls) 152 """Initializes the list of signatures from the Earth Engine front-end.""" 153 if not cls._api: --> 154 signatures = data.getAlgorithms() 155 api = {} 156 for name, sig in signatures.items(): 157 # Strip type parameters.

File /usr/local/lib/python3.10/site-packages/ee/data.py:1109, in getAlgorithms() 1093 """Get the list of algorithms. 1094 1095 Returns: (...) 1106 is not specified. 1107 """ 1108 try: -> 1109 call = _get_cloud_api_resource().projects().algorithms().list( 1110 parent=_get_projects_path(), prettyPrint=False) 1111 except TypeError: 1112 call = _get_cloud_api_resource().projects().algorithms().list( 1113 project=_get_projects_path(), prettyPrint=False)

File /usr/local/lib/python3.10/site-packages/ee/data.py:282, in _get_cloud_api_resource() 280 def _get_cloud_api_resource(): 281 if _cloud_api_resource is None: --> 282 raise ee_exception.EEException( 283 'Earth Engine client library not initialized. Run ee.Initialize()') 284 return _cloud_api_resource

EEException: Earth Engine client library not initialized. Run ee.Initialize()

— Reply to this email directly, view it on GitHubhttps://github.com/ChHarding/TouchTerrain_jupyter_docker/issues/12, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEYDF5OEXMCJFZAXTFKV7VDZIU3FZAVCNFSM6AAAAABJXIPQOKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM3DONZQGEZTSNI. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Chris Harding Associate Professor Department of Geological & Atmospheric Sciences Touchterrain.geol.iastate.edu