Skip to content

Commit e560d69

Browse files
authored
Move Python driver code on modeling2 from subversion into github repo TUV-x. (#122)
* Initial check-in from subversion on modeling2. * README.md file, first draft. * Better description of the tuv-x process. * Trying code tags for long lines of code. * Nope, I did not like that. No Copy button. Return to three back-tics.
1 parent c70efb3 commit e560d69

File tree

6 files changed

+1599
-0
lines changed

6 files changed

+1599
-0
lines changed

tool/python_driver/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<h1 align="center">
2+
<img src="../../docs/source/_static/logo.svg" width="300">
3+
</h1><br>
4+
5+
# Python driver for TUV-x
6+
7+
Copyright (C) 2024-5 National Center for Atmospheric Research
8+
9+
TUV-x is a Fortran application that calculates photolysis rates.
10+
ACOM has developed a [Quick TUV-x Calculator](https://www.acom.ucar.edu/Models/TUV/Interactive_TUV/tuv-x.shtml) that accepts user input and runs a calculation.
11+
The web interface for the TUV-x calculator runs on ACOM machine web3, while the Fortran executable runs on machine modeling2.
12+
A python script **tuv-x-remote.py** collects user input from the calculator form, formats the configuration into a json file,
13+
stores the cloud and aerosol radiators as NetCDF, and then launches the Fortran executable on modeling2.
14+
15+
When the calculation is complete, tuv-x-remote.py retrieves the results from a NetCDF file.
16+
The script then writes the results into a set of CSV, text, and NetCDF files, and packages them for user download in temporary directory.
17+
18+
Under this software architecture, the python script tuv-x-remote.py can also be used as a stand-alone driver for the Fortran engine.
19+
The batch script **goTuv-x-remote** provides several examples of calling tuv-x-remote.py from the Unix command line.
20+
21+
```
22+
python3 tuv-x-remote.py latitude=40.0 longitude=-105.0 date=20240320 time=19:00:00 photolysis=False actinic=False crossSections=False quantumYields=False customWavelength=False waveStart=280.0 waveEnd=700.0 waveIntervals=420.0 inputOption=1 zenithAngle=0.0 ozone=300.0 albedo=0.1 gElevation=2.0 height=4.888 customProfile=False temperature=3.14159 density=2.71828 cloudOptDepth=0.25 cloudSingScatAlbedo=0.9999 cloudAsymmetry=0.85 cloudTop=5.555 cloudBase=4.444 aerosolOptDepth=0.235 aerosolSingScatAlbedo=0.99 aerosolAsymmetry=0.62 aerosolAlpha=1.0 aerosolLambda0=550.0 directSun=1.0 diffDown=1.0 diffUp=1.0 numStreams=2
23+
```
24+
25+
# License
26+
27+
- [Apache 2.0](/LICENSE)
28+
- Copyright (C) 2024-5 National Center for Atmospheric Research
29+

tool/python_driver/goTuv-x-remote

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#python3 tuv-x-remote.py latitude=35.0 longitude=-120.0 date=20230604 time=17:24:00 actinic=False crossSections=False quantumYields=False
2+
#python3 tuv-x-remote.py latitude=40.0 longitude=-105.0 date=20230603 time=14:24:00 actinic=False crossSections=True quantumYields=True temperature=3.14159 density=2.71828 height=12.345
3+
#python3 tuv-x-remote.py latitude=40.0 longitude=-105.0 date=20230603 time=14:24:00 actinic=True crossSections=True quantumYields=True customProfile=False temperature=3.14159 density=2.71828 height=8.7 directSun=2.2 diffDown=3.3 diffUp=4.4
4+
#python3 tuv-x-remote.py latitude=40.0 longitude=-105.0 date=20230603 time=14:24:00 inputOption=2 zenithAngle=34.5678 actinic=False crossSections=False quantumYields=False customProfile=False temperature=3.14159 density=2.71828 height=35.8 directSun=2.2 diffDown=3.3 diffUp=4.4
5+
#python3 tuv-x-remote.py latitude=40.0 longitude=-105.0 date=20230320 time=19:00:00 inputOption=2 zenithAngle=0 actinic=False crossSections=False quantumYields=False customProfile=False temperature=3.14159 density=2.71828 height=0 directSun=2.2 diffDown=3.3 diffUp=4.4
6+
#python3 tuv-x-remote.py latitude=40.0 longitude=-105.0 date=20230320 time=19:00:00 inputOption=1 zenithAngle=0 actinic=False crossSections=False quantumYields=False customProfile=False temperature=3.14159 density=2.71828 height=66 directSun=2.2 diffDown=3.3 diffUp=4.4 customWavelength=False waveStart=288.0 waveEnd=777.0 waveIntervals=422.0
7+
#python3 tuv-x-remote.py customWavelength=False waveStart=280.0 waveEnd=700.0 waveIntervals=420.0 latitude=40.000000 longitude=-105.000000 date=20230320 time=19:00:00 inputOption=1 zenithAngle=34.5678 photolysis=False actinic=False crossSections=False quantumYields=False customProfile=False height=0.0 temperature=None density=None ozone=321.98765 directSunlight=1.0 diffuseDown=1.0 diffuseUp=1.0
8+
#python3 tuv-x-remote.py customWavelength=False waveStart=280.0 waveEnd=700.0 waveIntervals=420.0 latitude=40.000000 longitude=-105.000000 date=20230320 time=19:00:00 inputOption=1 zenithAngle=34.5678 photolysis=False actinic=False crossSections=False quantumYields=False customProfile=False gElevation=3.66 height=7.77 temperature=None density=None ozone=321.98765
9+
#python3 tuv-x-remote.py customWavelength=False waveStart=280.0 waveEnd=700.0 waveIntervals=420.0 latitude=40.000000 longitude=-105.000000 date=20230320 time=19:00:00 inputOption=1 zenithAngle=34.5678 photolysis=False actinic=False crossSections=False quantumYields=False customProfile=False gElevation=3.66 height=7.77 temperature=None density=None ozone=321.98765
10+
#python3 tuv-x-remote.py customWavelength=False waveStart=280.0 waveEnd=700.0 waveIntervals=420.0 latitude=40.000000 longitude=-105.000000 date=20230320 time=19:00:00 inputOption=1 zenithAngle=34.5678 photolysis=False actinic=False crossSections=False quantumYields=False customProfile=False gElevation=3.1 height=4.6 temperature=1258.272 density=11.598e+19 ozone=321.98765 numStreams=4 cloudBase=6.4 cloudTop=12.62
11+
python3 tuv-x-remote.py latitude=40.0 longitude=-105.0 date=20240320 time=19:00:00 photolysis=False actinic=False crossSections=False quantumYields=False customWavelength=False waveStart=280.0 waveEnd=700.0 waveIntervals=420.0 inputOption=1 zenithAngle=0.0 ozone=300.0 albedo=0.1 gElevation=2.0 height=4.888 customProfile=False temperature=3.14159 density=2.71828 cloudOptDepth=0.25 cloudSingScatAlbedo=0.9999 cloudAsymmetry=0.85 cloudTop=5.555 cloudBase=4.444 aerosolOptDepth=0.235 aerosolSingScatAlbedo=0.99 aerosolAsymmetry=0.62 aerosolAlpha=1.0 aerosolLambda0=550.0 directSun=1.0 diffDown=1.0 diffUp=1.0 numStreams=2
12+

0 commit comments

Comments
 (0)