AssetSelect#
Overview#
AssetSelect is a field widget to search for asset in the user GEE root folder. it inherits from the SepalWidget class.
Any argument from the original Combobox ipyvuetify class can be used to complement it.
from pysepal import sepalwidgets as sw
# correct colors for the documentation
# set to dark in SEPAL by default
import ipyvuetify as v
v.theme.dark = False
# to allow the build of the doc in a distanct server
FOLDER = "projects/earthengine-legacy/assets/users/bornToBeAlive/sepal_ui_test"
asset_select = sw.AssetSelect(folder=FOLDER)
asset_select
/home/docs/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.10/site-packages/google/api_core/_python_version_support.py:273: FutureWarning: You are using a Python version (3.10.19) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.api_core past that date. warnings.warn(message, FutureWarning)
---------------------------------------------------------------------------
JSONDecodeError Traceback (most recent call last)
File ~/checkouts/readthedocs.org/user_builds/sepal-ui/checkouts/latest/pysepal/scripts/gee.py:50, in need_ee.<locals>.wrapper_ee(*args, **kwargs)
49 try:
---> 50 init_ee()
51 except Exception:
File ~/checkouts/readthedocs.org/user_builds/sepal-ui/checkouts/latest/pysepal/scripts/gee.py:381, in init_ee()
380 # Extract the project name from credentials
--> 381 _credentials = json.loads(credential_file_path.read_text())
382 project_id = _credentials.get("project_id", _credentials.get("project", None))
File ~/.asdf/installs/python/3.10.19/lib/python3.10/json/__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
File ~/.asdf/installs/python/3.10.19/lib/python3.10/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of ``s`` (a ``str`` instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
File ~/.asdf/installs/python/3.10.19/lib/python3.10/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
Cell In[1], line 11
8 # to allow the build of the doc in a distanct server
9 FOLDER = "projects/earthengine-legacy/assets/users/bornToBeAlive/sepal_ui_test"
---> 11 asset_select = sw.AssetSelect(folder=FOLDER)
12 asset_select
File ~/checkouts/readthedocs.org/user_builds/sepal-ui/checkouts/latest/pysepal/scripts/gee.py:52, in need_ee.<locals>.wrapper_ee(*args, **kwargs)
50 init_ee()
51 except Exception:
---> 52 raise Exception("This function needs an Earth Engine authentication")
54 return func(*args, **kwargs)
Exception: This function needs an Earth Engine authentication
the value can be retrieve from the v_model trait.
Note
More information can be found here.