awesome-spectral-indices / spyndex Goto Github PK
View Code? Open in Web Editor NEWAwesome Spectral Indices in Python.
Home Page: https://spyndex.readthedocs.io/
License: MIT License
Awesome Spectral Indices in Python.
Home Page: https://spyndex.readthedocs.io/
License: MIT License
Hello,
The current dependencies management includes dev packages like earthengine-api. earthengine-api is heavy and users of spyndex don't necessary need it.
So it's better to mark this dependency as a dev dependency. You can for example use the extras_require key in setup.py file. It would looks like this :
import io
import os
import re
from setuptools import find_packages, setup
def read(filename):
...
setup(
name="spyndex",
version="0.3.0",
[...]
install_requires=[
"dask>=2021.9.1",
"matplotlib",
"numpy",
"pandas",
"python-box>=6.0",
"requests",
"seaborn",
"xarray",
],
extras_require={
"dev": ["earthengin-api", "eemont>=0.3.6"],
},
)
You can then install the regular version of this package with pip install .
or the dev version with pip install .[dev]
Thanks !
Create a datasets module where users can load datasets with different types to try spyndex.
Create a plots module where the user can visualize the behaviour of a spectral index value according to the change in the spectral inputs with anotated heatmaps.
Hi,
I have used this library to calculate some vegetation indices, but the "EVI", "GBNDVI", "GLI", "GRNDVI", "MSAVI", "MTVI2", and "VARI" could not calculate and I got this error:
MergeError: conflicting values for variable 'band' on objects to be combined. You can skip this check by specifying compat='override'.
Has there already been discussion and/or decisions about providing support for index specific constant defaults, e.g L=1.0 for EVI and L=0.5 for SAVI? I think having index specific defaults could make computing indices easier for users, and could avoid user errors of assuming the constant's default applies to all indices which use that constant.
Happy to discuss and to help with any related PR work, if you think this could be a potential enhancement!
Hello, I am the developer of python-box and see that it is a requirement in this repo and has not been version pinned.
I suggest that you pin it to the max known compatible version in your requirements.txt and/or setup.py file(s):
python-box[all]~=5.4
Or without extra dependencies
python-box~=5.4
Using ~=5.0
(or any minor version) will lock it to the major version of 5
and minimum of minor version specified.
If you add a bugfix space for 5.4.0
it would lock it to the minor version 5.4.*
.
The next major release of Box is right around the corner, and while it has many improvements,
I want to ensure you have a smooth transition by being able to test at your own leisure to ensure your standard user cases do not run into any issues. I am keeping track of major changes, so please check there as a quick overview of any differences.
To test new changes, try out the release candidate:
pip install python-box[all]~=6.0.0rc4
Add parallel computing support: dask
Hey,
I noticed that this project use setup.py. But this format is not the preferred format anymore for a python project : https://peps.python.org/pep-0518/ .
I can open a pull request if you agree to migrate to pyproject.toml and it will work in the same way it worked before.
I also notice that there is no wheel, we can in a second step generate wheels.
Bastien
I'm struggling to get spyndex
to work on my machine.
The installation with pip install spyndex
works like a charm, but when I run import spyndex
in python, I invariably get errors relating to ee.
So I'm wondering what version of earthengine-api you're based on, as all the versions I've tried so far result in various errors. Here what I get with the latest (earthengine-api==0.1.365
Traceback (most recent call last):
File "python\helpers\pydev\pydevconsole.py", line 364, in runcode
coro = func()
File "<input>", line 1, in <module>
File "python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "venv\lib\site-packages\spyndex\__init__.py", line 8, in <module>
from .axioms import bands, constants, indices
File "python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "venv\lib\site-packages\spyndex\axioms.py", line 3, in <module>
from .spyndex import computeIndex
File "python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "venv\lib\site-packages\spyndex\spyndex.py", line 7, in <module>
import ee
File "python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "venv\lib\site-packages\ee\__init__.py", line 15, in <module>
from ee import batch
File "python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "venv\lib\site-packages\ee\batch.py", line 15, in <module>
from ee import data
File "python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "venv\lib\site-packages\ee\data.py", line 542, in <module>
def listAssets(params: dict[str, Any]) -> dict[str, List[Any]]:
TypeError: 'type' object is not subscriptable
I'm working in Python 3.8.10.
Add omega
parameter for MBWI
. Default = 2.
Hi @davemlz,
I appreciate the work you have put into Awesome Spectral Indices and this package!
While working on this short guide for my students, I thought that it might be a good idea to separate bands and constants in SpectralIndex
objects. Meaning that when someone calls spyndex.indices.EVI.bands
, for example, it should not return ['g', 'N', 'R', 'C1', 'C2', 'B', 'L']
but only ['N', 'R', 'B']
. The constants could be returned separately with spyndex.indices.EVI.constants
.
I think it might otherwise lead to confusion, especially for inexperienced users. In the guide I've mentioned, I tried to clear this up by using list comprehension to separate them.
When using a global dictionary, avoid using the globals
argument.
Hello,
Would it be possible (if useful) to have default values for constants in specified index (ie. L for SAVI) ? ๐
I am trying to have the minimum required intervention from the user, so it would be helpful!
@davemlz is the gamma parameter a fixed constant or does it need to always be specified by the user ? It is not added in the constant class. Thanks for looking into this.
Check the _check_params
: It is not catching the indices dict when using online=True
Hello,
I would like to use your library in eoreader, to replace my own way of computing spectral indices.
I see that in setup.py
you still are in pre-alpha mode, but according to your code, documentation and README, you seems pretty well advanced.
So, should I wait an API stabilization ? Or am I good to go ? ๐
Hello,
Is it possible to compute custom indices that are not registered in Awesome Spectral Indices ?
My usecase is that I have maybe too specific indices that wouldn't be useful to the community.
Or indices using satellites not handled currently like WorldViews/PlanetScope with the Yellow band.
If not I would be happy to share them all ๐
Hello, i've been trying to use the computeIndex for NDWI but apart from all other indexes working well, NDWI has been presenting issues so i've tested every way to compute it correctly but it seems something's wrong.
The image below shows the test i've made using the same variables but computeIndex returning the wrong range of values:
Add kwargs
so users don't have to pass a dict
if they don't want to.
Example:
spyndex.computeIndex("NDVI",N = 0.67,R = 0.12)
instead of:
spyndex.computeIndex("NDVI",{"N": 0.67,"R": 0.12})
Add a SpectralIndex
class that allows to compute indices directly from spyndex.indices
.
Example:
spyndex.indices.NDVI.compute(args)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.