Contribution Steps
First, fork the eemont repository and clone it to your local machine. Then, create a development branch:
git checkout -b name-of-dev-branch
eemont is divided according to Earth Engine classes, and you will find a module for each class (e.g. imagecollection.py
). Look for the required class as follows:
The common.py
is used for methods that can be used for more than one Earth Engine class.
When creating new features, please start with the self
argument and add the corresponding decorator (
@extend()
from the extending
module). Check this example:
from .extending import extend
@extend(ee.image.Image, static = False)
def my_new_method(self,other):
'''Returns the addition of and image and a float.
Parameters
----------
self : ee.Image [this]
Image to add.
other : float
Float to add.
Returns
-------
ee.Image
Addition of an ee.Image and a float.
Examples
--------
>>> import ee, eemont
>>> ee.Initialize()
>>> img = ee.Image(0).my_new_method(other = 3.14)
'''
return self.add(other)
By using the @extend()
decorator, the my_new_method()
method is added to the ee.Image
class. If you want to add a static method, please set the static
argument to False
. Look for the required class as follows:
ee.Feature: ee.feature.Feature
ee.FeatureCollection: ee.featurecollection.FeatureCollection
ee.Geometry: ee.geometry.Geometry
ee.Image: ee.image.Image
ee.ImageCollection: ee.imagecollection.ImageCollection
ee.List: ee.ee_list.List
ee.Number: ee.ee_number.Number
Remember to use Black!
In order to test additions, you can use pytest
over the tests
folder:
This will automatically test all modules for the available satellite platforms through eemont. If you have added a new feature, please include it in the tests.
To test across different Python versions, please use tox
.
Now it’s time to commit your changes and push your development branch:
git add .
git commit -m "Description of your work"
git push origin name-of-dev-branch
And finally, submit a pull request.