-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from jmcook1186/add-easy-albedo-func
Add get_albedo() function
- Loading branch information
Showing
13 changed files
with
88 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import numpy as np | ||
from pathlib import Path | ||
from validate_inputs import validate_inputs | ||
from adding_doubling_solver import adding_doubling_solver | ||
from column_OPs import get_layer_OPs, mix_in_impurities | ||
from display import display_out_data, plot_albedo | ||
from setup_snicar import setup_snicar | ||
from toon_rt_solver import toon_solver | ||
|
||
|
||
def get_albedo(solver, plot, validate): | ||
( | ||
ice, | ||
illumination, | ||
rt_config, | ||
model_config, | ||
plot_config, | ||
impurities, | ||
) = setup_snicar("default") | ||
|
||
if validate: | ||
validate_inputs(ice, illumination, impurities) | ||
|
||
# now get the optical properties of the ice column | ||
ssa_snw, g_snw, mac_snw = get_layer_OPs(ice, model_config) | ||
tau, ssa, g, L_snw = mix_in_impurities( | ||
ssa_snw, g_snw, mac_snw, ice, impurities, model_config | ||
) | ||
# now run one or both of the radiative transfer solvers | ||
if solver == "toon": | ||
print("\nRunning biosnicar with the Toon solver\n") | ||
outputs = toon_solver( | ||
tau, ssa, g, L_snw, ice, illumination, model_config, rt_config | ||
) | ||
elif solver == "adding-doubling": | ||
print("\nRunning biosnicar with the adding-doubling solver\n") | ||
outputs = adding_doubling_solver( | ||
tau, ssa, g, L_snw, ice, illumination, model_config | ||
) | ||
else: | ||
return "solver not recognized, please choose toon or adding-doubling" | ||
|
||
if plot: | ||
plot_albedo(plot_config, model_config, outputs.albedo) | ||
display_out_data(outputs) | ||
return outputs.albedo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ IMPURITIES: | |
CFACTOR: 1 | ||
COATED: False | ||
UNIT: 1 | ||
CONC: [1000000 ,0] | ||
CONC: [0 ,0] | ||
|
||
PLOT: | ||
FIG_SIZE: (8,6) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import numpy as np | ||
from pathlib import Path | ||
from get_albedo import get_albedo | ||
|
||
# call easy albedo func | ||
albedo = get_albedo("adding-doubling", plot=True, validate=True) |
Oops, something went wrong.