Skip to content

Commit

Permalink
Merge pull request #27 from FormingWorlds/osf
Browse files Browse the repository at this point in the history
Osf
  • Loading branch information
lsoucasse authored Jul 5, 2024
2 parents b201ced + bdc7f8c commit 8da85fa
Show file tree
Hide file tree
Showing 105 changed files with 133 additions and 14,079,188 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ jobs:
- name: Test with pytest
run: |
pip install pytest
export FWL_DATA="./fwl_data"
source SOCRATES/set_rad_env
pytest
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ https://proteus-code.readthedocs.io
* `git clone [email protected]:FormingWorlds/JANUS.git`
* `cd JANUS`
* `pip install -e .`
3. Download spectral files from the [OSF repository](https://osf.io/vehxg/)
* Set the environment variable FWL_DATA to define where the spectral data files will be stored
* `export FWL_DATA=...`
* Run the following commands within a python environment (or script) to download all basic spectral files
* `from janus.utils.data import DownloadSpectralFiles`
* `DownloadSpectralFiles()`
* Alternatively, you can specify which spectral data you want to download, and optionally the number of bands
* `DownloadSpectralFiles("/Frostflow", 4096)`

### Run instructions
In the examples folder you can find python scripts showing typical usecases/workflows of atmosphere modelling with Janus.
11 changes: 9 additions & 2 deletions examples/SocRadConv.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from janus.utils.atmosphere_column import atmos
import janus.utils.StellarSpectrum as StellarSpectrum
from janus.utils.ReadSpectralFile import ReadBandEdges
from janus.utils.data import DownloadSpectralFiles

####################################
##### Stand-alone initial conditions
Expand All @@ -42,6 +43,8 @@
# Set up dirs
if os.environ.get('RAD_DIR') == None:
raise Exception("Socrates environment variables not set! Have you installed Socrates and sourced set_rad_env?")
if os.environ.get('FWL_DATA') == None:
raise Exception("The FWL_DATA environment variable where spectral data will be downloaded needs to be set up!")
dirs = {
"janus": str(files("janus"))+"/",
"output": os.path.abspath(os.getcwd())+"/output/"
Expand Down Expand Up @@ -74,11 +77,15 @@
shutil.rmtree(dirs["output"])
os.mkdir(dirs["output"])

#Download required spectral files
DownloadSpectralFiles("/Dayspring")
DownloadSpectralFiles("/stellar_spectra")

# Move/prepare spectral file
print("Inserting stellar spectrum")
StellarSpectrum.InsertStellarSpectrum(
dirs["janus"]+"data/spectral_files/Dayspring/256/Dayspring.sf",
dirs["janus"]+"data/spectral_files/stellar_spectra/Sun_t4_4Ga_claire_12.txt",
os.environ.get('FWL_DATA')+"/spectral_files/Dayspring/256/Dayspring.sf",
os.environ.get('FWL_DATA')+"/spectral_files/stellar_spectra/Sun_t4_4Ga_claire_12.txt",
dirs["output"]
)

Expand Down
11 changes: 9 additions & 2 deletions examples/demo_instellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import janus.utils.StellarSpectrum as StellarSpectrum
import janus.utils.phys as phys
from janus.utils.ReadSpectralFile import ReadBandEdges
from janus.utils.data import DownloadSpectralFiles

if __name__=='__main__':

Expand All @@ -26,6 +27,8 @@
# Set up dirs
if os.environ.get('RAD_DIR') == None:
raise Exception("Socrates environment variables not set! Have you installed Socrates and sourced set_rad_env?")
if os.environ.get('FWL_DATA') == None:
raise Exception("The FWL_DATA environment variable where spectral data will be downloaded needs to be set up!")
dirs = {
"janus": str(files("janus"))+"/",
"output": os.path.abspath(os.getcwd())+"/output/"
Expand All @@ -36,11 +39,15 @@
shutil.rmtree(dirs["output"])
os.mkdir(dirs["output"])

#Download required spectral files
DownloadSpectralFiles("/Oak")
DownloadSpectralFiles("/stellar_spectra")

# Setup spectral file
print("Inserting stellar spectrum")
StellarSpectrum.InsertStellarSpectrum(
dirs["janus"]+"data/spectral_files/Oak/Oak.sf",
dirs["janus"]+"data/spectral_files/stellar_spectra/Sun_t4_4Ga_claire_12.txt",
os.environ.get('FWL_DATA')+"/spectral_files/Oak/318/Oak.sf",
os.environ.get('FWL_DATA')+"/spectral_files/stellar_spectra/Sun_t4_4Ga_claire_12.txt",
dirs["output"]
)
band_edges = ReadBandEdges(dirs["output"]+"star.sf")
Expand Down
11 changes: 9 additions & 2 deletions examples/demo_runaway_greenhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from janus.utils.atmosphere_column import atmos
import janus.utils.StellarSpectrum as StellarSpectrum
from janus.utils.ReadSpectralFile import ReadBandEdges
from janus.utils.data import DownloadSpectralFiles

if __name__=='__main__':

Expand All @@ -26,6 +27,8 @@
# Set up dirs
if os.environ.get('RAD_DIR') == None:
raise Exception("Socrates environment variables not set! Have you installed Socrates and sourced set_rad_env?")
if os.environ.get('FWL_DATA') == None:
raise Exception("The FWL_DATA environment variable where spectral data will be downloaded needs to be set up!")
dirs = {
"janus": str(files("janus"))+"/",
"output": os.path.abspath(os.getcwd())+"/output/"
Expand All @@ -36,11 +39,15 @@
shutil.rmtree(dirs["output"])
os.mkdir(dirs["output"])

#Download required spectral files
DownloadSpectralFiles("/Oak")
DownloadSpectralFiles("/stellar_spectra")

# Setup spectral file
print("Inserting stellar spectrum")
StellarSpectrum.InsertStellarSpectrum(
dirs["janus"]+"data/spectral_files/Oak/Oak.sf",
dirs["janus"]+"data/spectral_files/stellar_spectra/Sun_t4_4Ga_claire_12.txt",
os.environ.get('FWL_DATA')+"/spectral_files/Oak/318/Oak.sf",
os.environ.get('FWL_DATA')+"/spectral_files/stellar_spectra/Sun_t4_4Ga_claire_12.txt",
dirs["output"]
)
print(" ")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [
'natsort',
'netcdf4',
'numpy',
'osfclient',
'pandas',
'scipy',
'seaborn',
Expand Down
1 change: 0 additions & 1 deletion src/janus/data/spectral_files/Dayspring/256/Dayspring.chk

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8da85fa

Please sign in to comment.