Skip to content

Commit

Permalink
Angstrom exp and simplifications (#29)
Browse files Browse the repository at this point in the history
* option mol_modify2 not in libradtran 2.0.4, modify to mol_modify

* adaptation to rubin-libradtran library

* adaptation to rubin-libradtran library

* no input nor output files are written on disk: directly gives the parameters and read the outputs from shell

* no input nor output files are written on disk: directly gives the parameters and read the outputs from shell

* faster solver

* add aerosols and angstrom exponent

* simplification of libradtranpy

* correct notebooks

* update doc

---------

Co-authored-by: Jérémy Neveu <jeremy.neveu@universite-paris-saclay.fr>
Co-authored-by: sylvielsstfr <dagoret@lal.in2p3.fr>
  • Loading branch information
3 people authored Feb 20, 2024
1 parent afca6bd commit 4376fbc
Show file tree
Hide file tree
Showing 13 changed files with 358 additions and 24,168 deletions.
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ The use of this interface is quite straight forwared provided the

### 1) Installation of libradtran

The atmospheric simulation LibRadTran for multiple site (different altitudes) must be installed according the instruction given in
http://www.libradtran.org/doku.php
The atmospheric simulation [libradtran](http://www.libradtran.org/doku.php) for multiple site (different altitudes)
There are two ways to install this software:
- use the [Rubin observatory conda package](https://anaconda.org/conda-forge/rubin-libradtran)
```
conda install -c conda-forge rubin-libradtran
```
- from sources, with instructions given in http://www.libradtran.org/doku.php

This documentation assumes libradtran version 2.0.5 is installed on your computer (version July 2023)
This documentation assumes libradtran version `>=2.0.4` is installed on your computer.


#### To use libradtran inside librandtranpy wrapper


Environnement variable **LIBRADTRANDIR** must be set to ``libRadtran`` installation path under which one have each of these directories:
If `libradtran` is installed from `conda-forge`, there is nothing to do.
If it is installed from sources, then an environnement variable **LIBRADTRANDIR** must be set to ``libRadtran``
installation path under which one have each of these directories:

- /bin
- /share/libRadtran/data
Expand Down Expand Up @@ -172,26 +178,18 @@ from libradtranpy import libsimulateVisible
A call without aerosols:

```python
path,thefile=libsimulateVisible.ProcessSimulation(am[index],pwv,ozone,pressure,
prof_str='us',proc_str='sa',cloudext=cloudext,altitude_str="LSST")
wl,transm=libsimulateVisible.ProcessSimulation(am[index],pwv,ozone,pressure,aer_num=0,
prof_str='us',proc_str='sa',cloudext=cloudext,altitude="LSST")
```

A call with aerosols:

```python
path,thefile = libsimulateVisible.ProcessSimulation(am[index],pwv,ozone,aer,pressure,
prof_str='us',proc_str='sa',cloudext=cloudext,altitude_str="LSST")
wl,transm = libsimulateVisible.ProcessSimulation(am[index],pwv,ozone,aer,pressure,aer_num=aer,angstrom_exponent_num=exponent,
prof_str='us',proc_str='sa',cloudext=cloudext,altitude="LSST")
```

**path,thefilename** are the path and filename of the output ascii file.

The result of the simulation can be obtained in a python environnement by:

```python
data = np.loadtxt(os.path.join(path,thefile))
wl = data[:,0]
atm = data[:,1]
```

The library ``libsimulateThermal`` can be used similarly. Please refers
to the ``libradtranpy`` package documentation.
Expand Down
13 changes: 7 additions & 6 deletions docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ The library ``libradtranpy`` generate the libradtran configuration file which is
It return the path of the output file generated by ``libRadtran`` in the format expected: two column
table, one for the wavelength, the second with the air transmission.

This library ``libradtranpy`` consists mainly in two functions with a number of input parameters which definition
This library ``libradtranpy`` consists mainly in one function with a number of input parameters which definition
are given in this documentation.

* ``libsimulateVisible.ProcessSimulation()`` without aerosols
* ``libsimulateVisible.ProcessSimulationaer()`` with aerosols calculated by ``libRadtran``.
* ``libsimulateVisible.ProcessSimulation()``

The two interfaces are very similar. It is recommended for the user to use mostly
``libsimulateVisible.ProcessSimulation()`` and to implements himself a simple parameterized
aerosol scattering fuunction similar to the one provided in ``libsimulateVisible.ApplyAerosols()``.

The ``libsimulateVisible`` module refers to the ``libRadtran visible running mode`` which applies
in the light visible range by contrast to the ``libRadtran thermal running mode`` which applies in the
Expand Down Expand Up @@ -113,6 +109,11 @@ Pressure
Ground pressure at the observation site. If not null, this value override the standard
pressure expected for the altitude of the selected observation site.


Aerosols
~~~~~~~~~~
aer_num,angstrom_exponent_num are respectively the VAOD and the Angtrom parameter,where the VAOD is at wavelength 500 nm.

atmospheric profile
~~~~~~~~~~~~~~~~~~~

Expand Down
7,697 changes: 8 additions & 7,689 deletions docs/notebooks/libradtranpy/visible/SimuRT_AbsPattern.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"- Sylvie Dagoret-Campagne\n",
"- affliliation : IJCLAB/IN2P3/CNRS\n",
"- creation date : 23 October 2023\n",
"- Last verification : October 23th 2023\n",
"- Last verification : October 20th 2024\n",
"\n",
"==================================================================================="
]
Expand Down Expand Up @@ -104,15 +104,7 @@
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"libradtranpath= /Users/dagoret/MacOSX/External/libRadtran/\n"
]
}
],
"outputs": [],
"source": [
"from libradtranpy import libsimulateVisible"
]
Expand Down Expand Up @@ -191,7 +183,7 @@
{
"data": {
"text/plain": [
"['/Users/dagoret/MacOSX/GitHub/LSST/AtmosphericSimulation/libradtranpy/docs/notebooks/libradtranpy',\n",
"['/Users/dagoret/MacOSX/GitHub/LSST/AtmosphericSimulation/libradtranpy/docs/notebooks/libradtranpy/visible',\n",
" '/Users/dagoret/anaconda3/envs/conda_py310/lib/python310.zip',\n",
" '/Users/dagoret/anaconda3/envs/conda_py310/lib/python3.10',\n",
" '/Users/dagoret/anaconda3/envs/conda_py310/lib/python3.10/lib-dynload',\n",
Expand All @@ -200,7 +192,7 @@
" '/Users/dagoret/MacOSX/GitHub/LSST/AtmosphericSimulation/AtmEmulator/src',\n",
" '/Users/dagoret/MacOSX/GitHub/LSST/AtmosphericSimulation/FitDiffAtmo/src',\n",
" '/Users/dagoret/MacOSX/GitHub/LSST/AtmosphericSimulation/libradtranpy/src',\n",
" '/Users/dagoret/anaconda3/envs/conda_py310/lib/python3.10/site-packages/getObsAtmo-0.1.0-py3.10.egg']"
" '/Users/dagoret/MacOSX/GitHub/LSST/AtmosphericSimulation/rubinsimphot/src']"
]
},
"execution_count": 11,
Expand Down Expand Up @@ -251,11 +243,8 @@
"all_obs = []\n",
"for index, site in enumerate(List_Of_All_sites):\n",
" all_obs.append(site)\n",
" path,thefile=libsimulateVisible.ProcessSimulation(am,pwv,ozone,pressure,\n",
" prof_str='us',proc_str='sc',cloudext=cloudext,altitude_str=site)\n",
" data = np.loadtxt(os.path.join(path,thefile))\n",
" wl = data[:,0]\n",
" atm = data[:,1] \n",
" wl,atm=libsimulateVisible.ProcessSimulation(am,pwv,ozone,pressure,aer_num=aer,\n",
" prof_str='us',proc_str='sc',cloudext=cloudext,altitude=site)\n",
" all_trans.append(atm)"
]
},
Expand Down Expand Up @@ -342,21 +331,15 @@
},
"outputs": [],
"source": [
"path,thefile=libsimulateVisible.ProcessSimulation(am,pwv,ozone,pressure,\n",
" prof_str='us',proc_str='sc',cloudext=cloudext,altitude_str='LSST')\n",
"data = np.loadtxt(os.path.join(path,thefile))\n",
"wl1 = data[:,0]\n",
"atm1 = data[:,1]\n",
"wl1,atm1=libsimulateVisible.ProcessSimulation(am,pwv,ozone,pressure,aer_num=aer,\n",
" prof_str='us',proc_str='sc',cloudext=cloudext,altitude='LSST')\n",
"Pstand = Dict_Of_sitesPressures['LSST']\n",
"label1 = f\"LSST site with P = {Pstand:.2f} hPa\"\n",
"\n",
"\n",
"Ptest = 743.0\n",
"path,thefile=libsimulateVisible.ProcessSimulation(am,pwv,ozone,Ptest,\n",
" prof_str='us',proc_str='sc',cloudext=cloudext,altitude_str='LSST')\n",
"data = np.loadtxt(os.path.join(path,thefile))\n",
"wl2 = data[:,0]\n",
"atm2 = data[:,1]\n",
"wl2,atm2=libsimulateVisible.ProcessSimulation(am,pwv,ozone,Ptest,aer_num=aer,\n",
" prof_str='us',proc_str='sc',cloudext=cloudext,altitude='LSST')\n",
"label2 = f\"LSST site with P = {Ptest:.2f} hPa\"\n",
"\n"
]
Expand Down

Large diffs are not rendered by default.

15 changes: 6 additions & 9 deletions docs/notebooks/libradtranpy/visible/SimuRT_One.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 4376fbc

Please sign in to comment.