Coder Social home page Coder Social logo

awesome-spectral-indices / spyndex Goto Github PK

View Code? Open in Web Editor NEW
177.0 7.0 19.0 5.42 MB

Awesome Spectral Indices in Python.

Home Page: https://spyndex.readthedocs.io/

License: MIT License

Python 100.00%
earth-engine google-earth-engine remote-sensing satellite-imagery spectral spectral-data spectral-indices spectral-index python python3 numpy xarray pandas

spyndex's Issues

Extras require for `spyndex`

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 !

Can't load the package in google colab

Hi, thank you for developing the package.
I tried to use it in fresh google colab session but it keeps giving me dask error.

The installation is successful but loading the package gives me this error:
image

thank you..

Add datasets module

Create a datasets module where users can load datasets with different types to try spyndex.

Add plots module

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.

issue in calculating some of the vegetation indices

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'.

Support index-specific constant defaults

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!

[Suggestion] Pin requirement versions (specifically python-box)

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

migrate from setup.py to pyproject.toml

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

`spyndex` breaks with `earthengine-api==0.1.365`

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`

Add omega parameter for MBWI. Default = 2.

Separate bands and constants in `SpectralIndex` objects

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.

Default values for constants in spectral indices

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!

QST: Maturity level of spyndex

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 ? ๐Ÿ˜„

QST: Compute custom spectral indices

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 ๐Ÿ˜„

Something wrong with NDWI

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:

image

Add `SpectralIndex` class

Add a SpectralIndex class that allows to compute indices directly from spyndex.indices.

Example:

spyndex.indices.NDVI.compute(args)

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.