Git Product home page Git Product logo

sepal_ui's Introduction

https://raw.githubusercontent.com/openforis/sepal-doc/master/docs/source/_images/sepal_header.png

Sepal_ui

License: MIT Black badge prettier badge conventional commit Citation Documentation Status PyPI version Conda Version supported Python version build Maintainability Test Coverage

Currently translated in the following languages:

English Français Español **人
https://img.shields.io/static/v1?label=en&message=100%&logo=crowdin&logoColor=white&color=blue https://img.shields.io/badge/dynamic/json?label=fr&logo=crowdin&logoColor=white&query=%24.progress.2.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15167678-506362.json https://img.shields.io/badge/dynamic/json?logoColor=white&label=es-ES&logo=crowdin&query=%24.progress.1.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15167678-506362.json https://img.shields.io/badge/dynamic/json?label=zh-CN&logo=crowdin&logoColor=white&query=%24.progress.5.data.translationProgress&url=https%3A%2F%2Fbadges.awesome-crowdin.com%2Fstats-15167678-506362.json

You can contribute to the translation effort on our crowdin project.


sepal_ui is a lib designed to create elegant python based dashboard in the SEPAL environment. It is designed on top of the amazing ipyvuetify library and will help developer to easily create interface for their workflows. By using this libraries, you'll ensure a robust and unified interface for your scripts and a easy and complete integration into the SEPAL dashboard of application.

The full documentation is available here and demo apps can be launched on Heroku following these links:

We are happy to receive feedback and we welcome any kind of contribution.

map-app panel-app

Contribute

If you want to contribute you can fork the project in you own repository and then use it. If you consider working with us, please follow the contributing guidelines.

Meet our contributor.

sepal_ui's People

Contributors

12rambau avatar 20geomine avatar dependabot[bot] avatar dfguerrerom avatar lecrabe avatar t-elisee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gab23r

sepal_ui's Issues

Local raster are not displayed in SEPAL dashboard apps

Local raster images are not being displayed in voilá dashboards nor Jupyter SEPAL dashboards, the problem comes up when the xarray_leaflet module is stating the base_url, using the 'notebooks' word.

The sepal module dashboards are being stored in /shared/notebooks/, so the condition is trying to find the last 'notebook' word, but as there are two occurrences in the URL, it will take the second, causing confusion and pointing to nowhere.

Three solutions come up to my mind:

  • Post to xarray-leaflet and try to change the way to get the base URL (could be using the first occurrence instead of the last).
  • Move the SEPAL dashboards to another folder
  • Change the structure in the xarray-leaflet module by forking it.

create tests

As the UI starts to be used in several modules that are available on the dashboard we should create some automatic tests to verify that the modification we implement don't break already existing components

add timestamp in output messages

In the Alert class, we are adding a message to che object children.

For output that always display the same message (gee interactions for example) I think we could add the timestamp to show the end user that the process is still running :

here is a proposal solution :

def add_msg(self, msg, type_='info'):
        self.show()
        self.type = type_ if (type_ in self.TYPES) else self.TYPES[0]
        self.children = [msg]

def add_output(self, msg, type_'info'):
    current_time = datetime.now().strftime("%Y/%m/%d, %H:%M:%S")

    self.show()
    self.type = type_ if (type_ in self.TYPES) else self.TYPES[0]
    self.children = [
        v.Html(tag='p', children=['[{}]'.format(current_time)]),
        v.Html(tag='p', children=[msg])
   ]

create a filinput widget

In all the apps the fileinput widget sucks as it's pointed to the local folder of the computer

The txt file dropdown is not a good workaround as people have too much file in there sepal folders.

cannot test geemap.Map()

Whenever I try to test geemap instances, I'm redirected to tha google authentification which is not possible in travis build.

I was thinking that the sepal_ui.scripts.utils.init_ee() function was enough of a workaround but geemap has it's own way of authenticating in earthengine.

asked in geemap repository : gee-community/geemap#189

add a aoi name interpreter

When the aoi is pulled from gee assets, they always come with the same patterned name. would be cool if we can retrieve this name automatically

such as

"aoi_myaoi" => "myaoi"

why giving bound for map zoom ?

def update_map(self, assetId, bounds, remove_last=False):
        """Update the map with the asset overlay and removing the selected drawing controls
        
        Args:
            assetId (str): the asset ID in gee assets
            bounds (list of tuple(x,y)): coordinates of tl, bl, tr, br points
            remove_last (boolean) (optional): Remove the last layer (if there is one) before 
                                                updating the map
        """  
        if remove_last:
            self.remove_last_layer()

        self.set_zoom(bounds, zoom_out=2)
        self.centerObject(ee.FeatureCollection(assetId), zoom=self.zoom)
        self.addLayer(ee.FeatureCollection(assetId), {'color': 'green'}, name='aoi')


    def set_zoom(self, bounds, zoom_out=1):
        """ Get the proper zoom to the given bounds.

        Args:

            bounds (list of tuple(x,y)): coordinates of tl, bl, tr, br points
            zoom_out (int) (optional): Zoom out the bounding zoom

        Returns:

            zoom (int): Zoom for the given ee_asset
        """

        tl, bl, tr, br = bounds
        
        maxsize = max(haversine(tl, br), haversine(bl, tr))
        lg = 40075 #number of displayed km at zoom 1
        zoom = 1
        while lg > maxsize:
            zoom += 1
            lg /= 2

        if zoom_out > zoom:
            zoom_out = zoom - 1

        self.zoom = zoom-zoom_out

I don't get why you gave bounds in AND assetId in updateZoom. Is it linked to a specific application ? because if you have the assetId you can easily compute the bounds ad if you want to zoom on something else you shoud not give the assetId.

Would you mind if I create two zooming method, one manual with bounds and zoom_out and an autmatic with assetId and an optional zoom_out ?

def centerAsset(assetId, zoom_out= 1):

    return self

def centerBounds(bounds, zoom_out=1):
    
    return self 

mapping basemap

geemap is a child class of both ipyleaflet and folium so we don't need to import any of these two object function

more importantly, the basemaps from leaflet are all natively supported like this :

m.add_basemap('CartoDB.Positron')

checkinput does not work if input is a dataset

I want to check a pts variable before launching a process.

if not wb.checkInput(pts, output, ms.NO_PTS): return su.toggleLoading(widget)

with pts being a pandas dataframe.

I raised the following error :

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

moving to dark theme ?

I realized that sepal_ui does not integrate so nicely in the rest of the sepal app as it's not using the same color scheme.

A good starting point would be to use the dark theme as default behaviour

what do you think ?

Capture d’écran 2020-11-24 à 17 16 04

implementation

to do it we need to add the :
v.theme = dark

and ask Daniel to use the ?voila-theme=dark option in the url
We tested it and it worked

why restricting the icons names in Btn ?

in the current implementation of Btn, only 'mdi-adjust' and 'mdi-download' are supported.
I suggest we let the user decide in the mdi lib which icon he wants to use.

In any case if you write an icon that does not exist ipyvuetify will display an empty square.

Add local tile layer (raster) inspector

Would be nice if the user could use the current geemap inspector to get the pixel value of the raster image, this function is useful to inspect a raster without the need of moving to a desktop app.

trigger resize event

The map are completely out of control when you move from one page to another so It would be better if the drawer activation trigger a resize event.

extract a shapefile from the assetId

If we want to continue to use the asset internally in sepal it could be useful to offer the possiblity to create a shapefile from the aoi geometry

add a gdrive module

Lots of the computation performed with python in sepal implies an interaction between gee (and gdrive) and the sepal folder.

Do you think it could be useful to create standard drive_handler object ? (inspired by the one in pysmm and glad_alert)

with some standard method like

  • get_items
  • download to sepal
  • print list
  • get file id
  • delete file
    ...

If some application requires specific implementation you can just create your custom drive_handler inheriting from this one

create a programatic sepal_app builder

Every git repository used to create a sepal app starts with the same things (a tree, a ui, a no_ui, a about section, a disclaimer, a gitignore, a licence) lets make it automatic with a app skeleton that you can launch when you start a new app

make Alert.clear only clear

For sementic reason I disagree with the way Alert.clear is designed :

def clear(self):
        self.hide()
        self.children = ['']

here the method hide AND clear. I think we must keep these methods separated and for clarity in codes do them manually

List of gdal command required in sepal_ui

Add in the comment the gdal command that you would like to see in sepal_ui
Remember that a lot of them are already bind in osgeo.gdal

Updated list of the oft functions in sepal_ui

  • gdal_merge.py
  • gdal_calc.py

move from travis CI to github Action

Travis CI decided to change its pricing model this week.

I only have 10000 jobs left before I need to pay for extra tests. This is there worse move as every open-source project will move to free billing services.

Anyway apparently the best alternative is to go to Github Actions, I'll look into int next week.

Remove the Downloads folder

Every time you start the module, it creates a Downloadsfolder with a capital D
I think it's coming from geemap as it's a default folder in the other OS (I mean not linux).

It conflicts with the default downloads folder of sepal, we must find a way to remove it or prevent it's creation

use FAO GAUL as base country map

The computation performed by our modules need to be based on the latest version of the FAO GAUL level 0 country boundaries.

ee.FeatureCollection("FAO/GAUL/2015/level0")

add a default assetId in class aoi

For some module the developer could have let a custom tutorial that require the use of a specific aoi. let it be declared in the _init of the aoi

bind the values and a alert

The only we can confirm to the end user the value that he has selected with the inputs is to use the alert.
This confirmation is (for me) important as some widgets can have slow behaviour (dropdowns and slider mainly).

at the moment the binding is performed with the function bind in widgetBinding module.

I suggest to add the bind function as a method of the Alert object of SepalWidget as such :

def bind(self, input, obj, variable, output_message='The selected variable is: '):

    #create the on_event litener

    #bind the obj variable to the input v_model

    #display it in the alert

    return 

what do you think ?

why get_bounds doesn't use the aoi asset ?

As a member method of Aoi_io, why the get_boundsmethod is not using the assetId value ?

def get_bounds(self, ee_asset=None, cardinal=False):
        """ Returns the min(lon,lat) and max(lon, lat) from the given asset

        Args:
            ee_asset (ee.object): GEE asset (FeatureCollection, Geometry)
            cardinal (boolean) (optional)

        Returns:
            If cardinal True: returns cardinal points tl, bl, tr, br
            If cardinal False: returns bounding box
        """

        # 
        ee_bounds = ee.FeatureCollection(ee_asset).geometry().bounds().coordinates()
        coords = ee_bounds.get(0).getInfo()
        ll, ur = coords[0], coords[2]

        # Get the bounding box
        min_lon, min_lat, max_lon, max_lat = ll[0], ll[1], ur[0], ur[1]


        # Get (x, y) of the 4 cardinal points
        tl = (min_lon, max_lat)
        bl = (min_lon, min_lat)
        tr = (max_lon, max_lat)
        br = (max_lon, min_lat)

        return (tl, bl, tr, br) if cardinal else (min_lon, min_lat, max_lon, max_lat)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.