EO-College / cubes-and-clouds

This is the official repository for the online course 'Cubes & Clouds'
Creative Commons Attribution 4.0 International
32 stars 12 forks source link

Exercise 3.3 Data Sharing: leafmap error #37

Closed JorisCod closed 5 months ago

JorisCod commented 6 months ago

I am getting an error when opening the map:

image

Restarting the kernel does not help.

JorisCod commented 6 months ago

It seems this: import leafmap

needs to become: import leafmap.foliumap as leafmap

przell commented 6 months ago

Hi Joris, thanks for the feedback. @UndeadFairy and @Ruphai can you have a look at that?

JorisCod commented 6 months ago

ok thanks!

btw using the change above gives rise to another issue in the next cell, so not sure it's the correct change:

image

przell commented 6 months ago

@JorisCod, hi, sorry for the inconvenience. I suspect that a wrong kernel is assigned to the notebook, additionally the workflow is not 100% straight forward.

This might be workaround to allow you to keep going.

  1. Could you try to select this kernel: image

  2. Then execute the cell that displays the map. And directly use the marker tool to select a point. image

  3. Then exectue the next cell and zoom in to your pointer (still on the previous map widget). The bounding box should appear. image

JorisCod commented 6 months ago

This works for the map, but later on I get: !gdal_translate -mo {TIFFTAG_IMAGEDESCRIPTION}=SnowCoveredArea_0=nosnow_1=snow_2-nodatavalue=cloud -ot Byte -of COG -a_nodata 2 -stats "33_results/openEO.tif" "33_results/openEO_uint8.tif" Input file size is 130, 204 ERROR 1: Failed to compute statistics, no valid pixels found in sampling. 0...10...20...30...40...50...60...70...80...90...100 - done.

Inputs: temporal_extent = ["2023-02-01", "2023-06-01"] bbox (4.399699783940813, 51.213499094951224, 4.417686216059188, 51.23153890504877)

Ruphai commented 6 months ago

@JorisCod, thank you for sharing this. Could you also provide the output of gdalinfo 33_results/OpenEO.tif in your coding environment? It's seems like the file (OpenEO.tif) might be invalid.

JorisCod commented 6 months ago
Driver: GTiff/GeoTIFF
Files: ./33_results/openEO.tif
Size is 130, 204
Coordinate System is:
PROJCRS["WGS 84 / UTM zone 31N",
    BASEGEOGCRS["WGS 84",
        ENSEMBLE["World Geodetic System 1984 ensemble",
            MEMBER["World Geodetic System 1984 (Transit)"],
            MEMBER["World Geodetic System 1984 (G730)"],
            MEMBER["World Geodetic System 1984 (G873)"],
            MEMBER["World Geodetic System 1984 (G1150)"],
            MEMBER["World Geodetic System 1984 (G1674)"],
            MEMBER["World Geodetic System 1984 (G1762)"],
            MEMBER["World Geodetic System 1984 (G2139)"],
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]],
            ENSEMBLEACCURACY[2.0]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4326]],
    CONVERSION["UTM zone 31N",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",3,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["(E)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["(N)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["Engineering survey, topographic mapping."],
        AREA["Between 0°E and 6°E, northern hemisphere between equator and 84°N, onshore and offshore. Algeria. Andorra. Belgium. Benin. Burkina Faso. Denmark - North Sea. France. Germany - North Sea. Ghana. Luxembourg. Mali. Netherlands. Niger. Nigeria. Norway. Spain. Togo. United Kingdom (UK) - North Sea."],
        BBOX[0,0,84,6]],
    ID["EPSG",32631]]
Data axis to CRS axis mapping: 1,2
Origin = (597720.000000000000000,5676530.000000000000000)
Pixel Size = (10.000000000000000,-10.000000000000000)
Metadata:
  AREA_OR_POINT=Area
  PROCESSING_SOFTWARE=0.28.2a1
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  597720.000, 5676530.000) (  4d23'58.71"E, 51d13'54.38"N)
Lower Left  (  597720.000, 5674490.000) (  4d23'56.70"E, 51d12'48.36"N)
Upper Right (  599020.000, 5676530.000) (  4d25' 5.71"E, 51d13'53.57"N)
Lower Right (  599020.000, 5674490.000) (  4d25' 3.69"E, 51d12'47.55"N)
Center      (  598370.000, 5675510.000) (  4d24'31.20"E, 51d13'20.97"N)
Band 1 Block=256x256 Type=Float64, ColorInterp=Gray
  NoData Value=nan
simoneleman commented 6 months ago

i am having the following problem; --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[11], line 1 ----> 1 feat = m.draw_features 2 geom = feat[0]['geometry']['coordinates'] 4 # set distance of 1 km around bbox

AttributeError: 'Map' object has no attribute 'draw_features', despite using the suggested solution above

Ruphai commented 6 months ago

okay @JorisCod could you test this with another ROI or do a re-run for this area? You could also try to open the OpenEO.tif in a GIS software to check if the output is corrupted.

Ruphai commented 6 months ago

i am having the following problem; --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[11], line 1 ----> 1 feat = m.draw_features 2 geom = feat[0]['geometry']['coordinates'] 4 # set distance of 1 km around bbox

AttributeError: 'Map' object has no attribute 'draw_features', despite using the suggested solution above

@zakula1916 in general, the cubes-and-clouds-cubes_and_clouds kernel should load the required libraries for this interactive map display. Could you provide more information on the kernel used and any potential changes you made in the notebook so far?

przell commented 6 months ago

@Ruphai, @UndeadFairy, @clausmichele, I suspect that more people have this problem, but they don't report on github. We don't see very many maps on the STAC Browser. It would be great if this part could be solved, facilitated and made stable.

JorisCod commented 6 months ago

I managed to get a bit further by changing my AOI so it does include snow. However, I am getting another error:

image

You can find my notebook to reproduce here: https://www.dropbox.com/scl/fi/sf6u3j4zhjdf7a8c5jza4/33_data_sharing2.ipynb?rlkey=9ie1clv3w6m2us7miurzrog4z&dl=0 I also printed the bbox so you don't have to depend on the map.

If the bbox and gdalinfo are relevant for debugging I would recommend adding it to the notebook to ease solving future problems.

przell commented 6 months ago

@all-contributors add @JorisCod for Bug reports.

Ruphai commented 5 months ago

@JorisCod @zakula1916 can you please check if the exercise environment and the metadata extraction now work correctly.

@JorisCod the issue you faced with the no valid pixel was actually a pointer that the area you had selected was mostly covered by clouds, which automatically returns a no data value and hence would be displayed as blank in the STAC Browser.

Ideally, to have a display in the current version of the STAC browser, the image statistics should be attached to the file (hence the step with the gdal_translate in the exercise).