From c013e0eae541b856990b9124edd360b1fbcc205c Mon Sep 17 00:00:00 2001 From: "tristan.harmel" <tristan.harmel@get.omp.eu> Date: Fri, 13 Sep 2019 14:51:30 +0200 Subject: [PATCH] test readme --- README.md | 48 ++++++++++++++++++++++++--------- setup.py | 2 +- trios.egg-info/PKG-INFO | 4 +-- trios.egg-info/SOURCES.txt | 2 ++ trios.egg-info/entry_points.txt | 2 +- trios/main.py | 26 +++++++++++++----- 6 files changed, 61 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index bbbf081..7a71dce 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,32 @@ # Water color TriOS package Package to process TriOS-like radiometer data for various acquisition protocols: -- above-water radiometry + +- **Above-Water Radiometry** (_awr_): R<sub>rs</sub> (sr<sup>-1</sup>) <p align="center"> <img src="images/above_water_system.png" width="400"> </p> -- in-water radiometry +- **In-Water Radiometry** (_iwr_): R<sub>rs</sub> (sr<sup>-1</sup>), K<sub>d</sub> (m<sup>-1</sup>), K<sub>Lu</sub> (m<sup>-1</sup>) + +<p align="center"> + <img src="images/in_water_system.png" width="400"> +</p> + +- **Surface-Water Radiometry** (_swr_): R<sub>rs</sub> (sr<sup>-1</sup>) - +<p align="center"> + <img src="images/surface_water_radiometry.png" width="400"> +</p> -- surface-water radiometry - This package also contains tools for interactive visualization of the radiometric data:  + ## Getting Started These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. @@ -28,20 +36,35 @@ These instructions will get you a copy of the project up and running on your loc What things you need to install the software and how to install them ``` -Give examples +python3 -m pip install --user --upgrade setuptools ``` ### Installing -A step by step series of examples that tell you how to get a development env running +First, clone `the repository <https://gitlab.irstea.fr/telquel-obs2co/insitu/trios>`__ and execute the following command in the +local copy: +:: -``` -python setup.py install -``` + $ python setup.py install + +This will install the package into the system's Python path. If another +destination directory is preferred, it can be set by + +:: + + $ python setup.py install --prefix=<where-to-install> + +This installation is supposed to download +and compile all the associated packages as well as prepare the executables `trios_processing` and `trios_visual`. ## Running the tests +``` +trios_processing ./test/data/ 150 awr --lat 42.30351823 --lon 9.462897398 --odir ./test/results --no_clobber +trios_processing ./test/data/ 150 awr --lat 42.30351823 --lon 9.462897398 --odir ./test/results --method M99 --name _M99 --plot --figdir ./test/fig +trios_processing ./test/data/ 150 awr --lat 42.30351823 --lon 9.462897398 --odir ./test/results --method osoaa --name _osoaa --plot +``` ## Authors @@ -56,6 +79,5 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md ## Acknowledgments -* Hat tip to anyone whose code was used -* Inspiration -* etc +This work has been partially supported by the _Programme National de Télédétection Spatiale_ (PNTS, +http://www.insu.cnrs.fr/pnts ), grant n°PNTS-2019-13 \ No newline at end of file diff --git a/setup.py b/setup.py index 2089c1b..c4fc37b 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,6 @@ setup( entry_points={ 'console_scripts': [ 'trios_processing = trios.main:main', - 'visu_trios = visu.data_visu:main' + 'trios_visual = visu.data_visu:main' ]} ) diff --git a/trios.egg-info/PKG-INFO b/trios.egg-info/PKG-INFO index 1202c7b..de18d92 100644 --- a/trios.egg-info/PKG-INFO +++ b/trios.egg-info/PKG-INFO @@ -1,8 +1,8 @@ Metadata-Version: 1.0 Name: trios -Version: 1.1.4 +Version: 1.0.0 Summary: Package to help trios TriOS radiometer data for various above-water or in-water setups -Home-page: https://gitlab.irstea.fr/ETL-TELQUEL/etl/tree/dev/preprocessing/trios +Home-page: https://gitlab.irstea.fr/telquel-obs2co/insitu/trios Author: T. Harmel Author-email: tristan.harmel@gmail.com License: MIT diff --git a/trios.egg-info/SOURCES.txt b/trios.egg-info/SOURCES.txt index 900b5ee..1435d2a 100644 --- a/trios.egg-info/SOURCES.txt +++ b/trios.egg-info/SOURCES.txt @@ -14,10 +14,12 @@ aux/surface_reflectance_factor_rho_fine_aerosol_rg0.06_sig0.46.csv aux/water_coef.txt exe/__init__.py exe/db_martinez.py +exe/db_petit-saut.py simulation/__init__.py simulation/rho_snapshot.py trios/__init__.py trios/config.py +trios/main.py trios/process.py trios/process_compar_awr.py trios/process_sabine.py diff --git a/trios.egg-info/entry_points.txt b/trios.egg-info/entry_points.txt index 16a4ca1..9462ce9 100644 --- a/trios.egg-info/entry_points.txt +++ b/trios.egg-info/entry_points.txt @@ -1,4 +1,4 @@ [console_scripts] -trios = main:main +trios_processing = trios.main:main visu_trios = visu.data_visu:main diff --git a/trios/main.py b/trios/main.py index d542eac..13e8b20 100644 --- a/trios/main.py +++ b/trios/main.py @@ -2,7 +2,8 @@ Usage: trios_processing <input_dir> <IDpr> <measurement_type> --lat <lat> --lon <lon> \ - [--altitude=alt] [--ofile <ofile>] [--odir <odir>] [--plot] [--figdir <figdir>] + [--altitude=alt] [--ofile <ofile>] [--odir <odir>] [--plot] [--figdir <figdir>] \ + [--name <name>] [--method <method>] [--no_clobber] trios_processing -h | --help trios_processing -v | --version @@ -22,6 +23,9 @@ Options: --ofile ofile basename of the output file. --plot Plot output data and save figure in <figdir> --figdir figdir Directory where figures are saved [default: ./] + --name name Keyword to append to file name and figures [default: ] + --method method Keyword for the method to apply for data processing. + For awr: M99, M15, osoaa, temp_opt [default: M99] --no_clobber Do not process <input_dir> <IDpr> files if <output_file> already exists. ''' @@ -51,14 +55,16 @@ def main(): idir = os.path.abspath(args['<input_dir>']) idpr = args['<IDpr>'] meas_type = args['<measurement_type>'] + method = args['--method'] lat = float(args['--lat']) lon = float(args['--lon']) alt = float(args['--altitude']) odir = os.path.abspath(args['--odir']) ofile = args['--ofile'] - name = "" + name = args['--name'] plot = args['--plot'] figdir = os.path.abspath(args['--figdir']) + noclobber = args['--no_clobber'] try: type_ = type_list[meas_type] @@ -82,6 +88,10 @@ def main(): else: ofile = os.path.join(odir, 'Rrs_swr_' + date + '_idpr' + idpr + name + '.csv') + if noclobber and os.path.exists(ofile): + print('Skip processing: data already processed with "--no_clobber" set') + return + swr = swr_process(df, wl) Rrs = swr.call_process(ofile) @@ -93,7 +103,7 @@ def main(): ax.set_ylabel(r'$R_{rs}\ (sr^{-1})$') ax.set_xlabel(r'Wavelength (nm)') ax.set_title('ID: ' + idpr + ', ' + date + ', sza=' + str(round(df.sza.mean(), 2))) - fig.savefig(os.path.join(figdir, 'trios_swr_' + date + '_idpr' + idpr + '.png'), bbox_inches='tight') + fig.savefig(os.path.join(figdir, 'trios_swr_' + date + '_idpr' + idpr + name+'.png'), bbox_inches='tight') plt.close() elif meas_type == 'awr': @@ -113,14 +123,18 @@ def main(): else: ofile = os.path.join(odir, 'Rrs_awr_' + date + '_idpr' + idpr + name + '.csv') + if noclobber and os.path.exists(ofile): + print('Skip processing: data already processed with "--no_clobber" set') + return + awr = awr_process(df, wl, name, idpr) if plot: - figfile = os.path.join(figdir, 'trios_awr_' + date + '_idpr' + idpr + '.png') + figfile = os.path.join(figdir, 'trios_awr_' + date + '_idpr' + idpr + name +'.png') else: - figfile="" + figfile = "" - Rrs = awr.call_process(method, ofile, vza=vza, azi=azi,plot_file=figfile) + Rrs = awr.call_process(method, ofile, vza=vza, azi=azi, plot_file=figfile) elif meas_type == 'iwr': pass -- GitLab