Code Monkey home page Code Monkey logo

rt1's Introduction

Windows_build Ubuntu_build Coverage Status pypi version Documentation Status DOI

RT1 - bistatic scattering model for first order scattering of random media


Caution

This package is superseeded by a TUW-GEO/rt1_model!
(TUW-GEO/rt1_model provides similar functionalities but with a simplified and more robust API)


The package implements a first order scattering radiative transfer model for random volume over ground as documented in Quast & Wagner (2016) and Quast, Albergel, Calvet, Wagner (2019)

The documentation of the package is found here. (Note that the documentation is still under construction.)

Overview of the RT1 python-module structure

RT1_overview

  • ๐Ÿž๏ธ rt1.volume and rt1.surface

    • a collection of useful surface- and volume scattering distribution functions
  • ๐Ÿ”จ rt1.rt1

    • generic implementation of radiative transfer calculations for a random volume over ground

    • symbolic evaluation of first-order interaction contribution estimates

  • โš™๏ธ rt1.rtfits

    • a flexible interface to perform parameter estimation from incidence-angle
      dependent backscatter-timeseries via non-linear least-squares fitting routines.

    • integrates with a set of pre-defined plot-functions and interactive
      widgets that can be used to quickly analyze the obtained results

  • ๐Ÿš€ rt1.rtprocess

    • a versatile interface to setup and run parallelized processing
  • ๐Ÿ“‘ rt1.rtparse

    • a configparser to set up processing-routines via .ini files

Usage

Any usage of this code is subject to the following conditions:

โ— Full compliance with the license (see LICENSE file) is given
โ— In publications or public presentations, credit should be given to the authors by:

  • citing the references below โœ”๏ธ
  • pointing to this github repository โœ”๏ธ

Installation

For a basic install, the following line should be fine:

pip install rt1

In order to get a significant speedup in the symbolic computations and enable NetCDF functionalities, it is recommended to install the module with the optional dependencies symengine and xarray by using:

pip install rt1[full]

References

rt1's People

Contributors

bulli92 avatar katrinleinweber avatar ndraeger avatar raphaelquast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

ndraeger wpreimes

rt1's Issues

fit-module

  • a class to fit the module to monostatic measurements has been added (rtfits.py)
  • an example-file has been added to show the basic functionality (examples_fitting.py)
  • first unittest has been added (test_rtfits.py)

Setup

Implement proper setup.py for the package

  • setup.py
  • PIP distribution

check behaviour for unsorted datasets

  • input-datasets that are not sorted in time result in irradic behaviour!
    • add option for "data already sorted"
    • sort dataset by default prior to processing

stickler-CI support

create .stickler.yml file

stickler-ci configuration

linters:
flake8:
pep8:
files:
ignore: []

Documentation

add more comprehensive documentation and link to READTHEDOCS

Implement test for zero order turbid media

One test that could be implemented is for a complete homogeneous turbid media with an isotropic surface.

The result of the model should then correspond to the zero order solution based on the transmissivity calculated using the Lambert-Beer law.

treat all parameters equally

get rid of the special treatment of omega, NormBRDF and bsf such that they can
be provided similarly to any other V or SRF specifications

Figures from paper are NOT reproduced

The figures for example 01 and example 02 are not the same as those within the Quast & Wagner paper. Seems that there is still something wrong here.

@raphaelquast can you please check if you can reproduce this error?

Examples can be found in the documentation branch.

Testing

Automated testing using nosetests and TRAVIS

  • add YML file etc.

custom phase-function implementation

A documentation on how to manually define phase-functions and BRDF's would be great...

It's currently possible by changing the properties of a given surface- or volume-class element
but I think we should have a clear and save way how to do it ...
(for example by defining a dummy- surface- and volume-class element that is
intended to be defined by the user)

@bulli92 Any ideas on how to properly implement such a possibility?

AttributeError: 'LinCombV' object has no attribute 'ncoefs'

I installed rt1 under conda environment of python 3.10 using the command pip install rt1[full].
Then I tried the example https://github.com/TUW-GEO/rt1/blob/master/doc/examples/example_lin_comb.ipynb. But when I was running

res = pd.DataFrame(dict(zip(('tot','surf','vol','inter'), R.calc())), index=inc)

I got the error like:

runcell(6, '/Users/xushan/research/TUD/test_jackknife/rt1/toy_example.py')
Traceback (most recent call last):

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 309, in _get_fnevals
    return self.__fnevals

AttributeError: 'RT1' object has no attribute '_RT1__fnevals'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 275, in _get_fn
    return self.__fn

AttributeError: 'RT1' object has no attribute '_RT1__fn'


During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/xushan/research/TUD/test_jackknife/rt1/toy_example.py", line 71, in <module>
    res = pd.DataFrame(dict(zip(('tot','surf','vol','inter'), R.calc())), index=inc)

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 690, in calc
    Iint = self.interaction()

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 1228, in interaction
    Fint1 = self._calc_Fint_1()

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 1268, in _calc_Fint_1
    fn = np.broadcast_arrays(*self._fnevals(args))

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 311, in _get_fnevals
    self._set_fnevals(self._fnevals_input)

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 340, in _set_fnevals
    self.fn,

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 277, in _get_fn
    self._set_fn(self.fn_input)

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 292, in _set_fn
    expr_int = self._calc_interaction_expansion()

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rt1.py", line 545, in _calc_interaction_expansion
    volexp = self.V.legexpansion(

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/volume.py", line 325, in legexpansion
    assert self.ncoefs > 0

AttributeError: 'LinCombV' object has no attribute 'ncoefs'

So what happened? Could you please help me to solve this issue? Thanks!

correct BRDF normalization

fix standard BRDF normalizations such that they are consistent for the isotropic case, i.e.

  • Isotropic := NormBRDF / pi
  • HenyeyGreenstein(t=0) = Isotropic = NormBRDF /pi
    - currently we have: HenyeyGreenstein(t=0) = N / (4pi)
  • CosineLobe(i=0) = Isotropic = NormBRDF/pi
    - currently we have: CosineLobe(i=0) =NormBRDF

-> adapt tests to fit to the new normalizations

drop python 2 support

  • tests on dev-branch are currently failing for python2 (simple syntax problems)
  • new versions of numpy, pandas etc will also drop support from 2020 on...

Python 3 support

As this is a rather new project, we should ensure that it supports python 3.x from the beginning before releasing it.

Should take minor effort to do this, but would need to build up some expertise here.

Change also travis.yml to perform tests for different python versions

Implement more tests

  • some more tests for simple analytic solutions would be nice
  • use rtfits.performfit() in tests of rtfits module
  • change to cse_symengine_sympy backend in tests

Additional variables as optional output?

Currently the output of the model is the top of canopy (or volume) specific intensity.

For many applications, it is also desirable to have additional information about e.g

  • total canopy transmission
  • total canopy absorption

These are implicitly simulated, but are not an output of the model at the moment. Is it possible to have these additional parameters as an output using the current technical ?

Model calibration / tuning

One could think of using a deterministic model like e.g. the AIEM or others and fit RT1 coefficients to that model.

One could also think of using existing model of dielectric shapes (e..g for vegetation layers) to determine the phase function behavior and obtain coefficients required for RT1.

Not really thought through, just as an idea.

add some more tests

  • test unsorted groupings
    • test interpolation with unsorted groupings
  • test load() function
  • test start-value assignments via dataset
  • test dynamics assignment via integers
  • test general_functions.scale and others

array-processing for tau, omega and R

Correct treatment of array-processing for tau, omega and R (the hemispher. reflect.)

  • this is crucial in order to have fast series-processing (e.g. time-series)
  • caching makes it possible to calculate series in approx. same time as single values!
  • simultaneous least_squares fitting of multiple datasets possible

unify nomenclature for incidence-angle

within the code, the use of theta_0 , theta_i and mu_0
is not fully consistent, evident from definitions such as:

  • theta_i = np.arccos(mu_0)
  • def thetap(self, thetai, thetas, phii, phis, a=[-1.,1.,1.])
    which is actually defined to represent thetap with zenith-angle arguments (theta_0, theta_s)

-> this needs to be corrected in order to be able to write a consistent documentation

include delta-solutions

A possibility for choosing delta-distributions as phase-functions and/or BRDF's would
be nice. This could be achieved by directly including the exact solutions which can easily be gained for delta-like scattering-distributions.

unify thetap and thetaBRDF

since thetap and theteBRDF only differ due to the initialization of the
a-parameter in the volume- or surface-class, they are actually a duplicate
of each other, and we can combine them to a single function scat_angle( ... )

  • tests need to be adapted if functions are changed
  • whenever scat_angle() is called within the definition of a phase-function, one
    must provide self.a as argument since the default value of the a-parameter of
    scat_angle( ... ) will change with respect to the class in which it is used.
    i.e. within _set_function always use:
    self.scat_angle(theta_i,theta_s,phi_i,phi_s, self.a)

UnboundLocalError: local variable 'fig' referenced before assignment

The error happens when I ran the code:

    import matplotlib.pyplot as plt
    fig = plt.figure(figsize=(25, 7))
    ax1 = fig.add_subplot(111, projection='polar')
    ax2 = fig.add_subplot(121, projection='polar')
    
    # plot BRDF and phase function
    plot1 = SRF.polarplot(inc = list(np.linspace(0,85,5)), multip = 1.5, legpos = (0.,0.5), polarax=ax2,
                         label='Surface scattering phase function', legend=True)
    plot2 = V.polarplot(inc = list(np.linspace(0,120,5)) ,multip = 1.5, legpos = (0.0,0.5), polarax=ax1,
                         label='Volume scattering phase function', legend=True)
    
    fig.tight_layout()

in the example: https://github.com/TUW-GEO/rt1/blob/master/doc/examples/example_lin_comb.ipynb.
The error information is:

Traceback (most recent call last):

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
    exec(code, globals, locals)

  File "/Users/xushan/research/TUD/vodca/demo_rt1.py", line 120, in <module>
    plot1 = SRF.polarplot(inc = list(np.linspace(0,85,5)), multip = 1.5, legpos = (0.,0.5), polarax=ax1,

  File "/Users/xushan/opt/anaconda3/envs/py310/lib/python3.10/site-packages/rt1/rtplots.py", line 263, in polarplot
    return fig

UnboundLocalError: local variable 'fig' referenced before assignment

It seems that the fig is not explicitly assigned in the function rtplots.py if polarax is not None.

example notebooks outdated

the example-notebooks have not been updated for a long time...

  • the monofit function that is used in there has been depreciated...
    (it should be replaced with performfit)
  • update structure to new configuration
  • use already implemented plotfunctions
  • ...

implement logger

implement a proper logging mechanism
(instead of warnings and prints)

warning if parameter-usage is not uniquely defined

there's currently no warning if a parameter is intended to be fitted but a corresponding key is provided in fixed_dict.
(in this case, the fixed_dict values will be used and the parameter will not be fitted!

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.