Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
CIBW_BUILD: cp${{ env.PY_VERSION }}*
CIBW_ARCHS: ${{ env.MACOS_ARCH }}
CIBW_BEFORE_BUILD: |
pip install numpy 'cmake<=3.30' 'pydisort>=1.4.1' 'torch==2.7.1'
pip install numpy 'cmake<=3.30' 'pydisort>=1.4.5' 'torch==2.7.1'
brew update
brew install netcdf
TORCH_CMAKE_PREFIX_PATH=$(python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)')
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
CIBW_SKIP: "*musllinux*"
CIBW_BEFORE_BUILD: |
yum install -y epel-release && yum install -y netcdf-devel
pip install numpy 'cmake<=3.30' 'pydisort>=1.4.1' 'torch==2.7.1'
pip install numpy 'cmake<=3.30' 'pydisort>=1.4.5' 'torch==2.7.1'
TORCH_CMAKE_PREFIX_PATH=$(python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)')
export LD_LIBRARY_PATH=$(python -c "import torch; print(torch.__path__[0] + '/lib')"):$(pwd)/build/lib:$LD_LIBRARY_PATH
$LD_LIBRARY_PATH
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Install Python dependencies
run: |
pip install numpy 'pydisort>=1.4.1' 'torch==2.7.1'
pip install numpy 'pydisort>=1.4.5' 'torch==2.7.1'

- name: Install NetCDF
run: |
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ requires = [
"wheel",
"build",
"ninja",
"pydisort>=1.4.1",
"pydisort>=1.4.5",
"cmake>=3.20",
"torch<=2.7.1,>=2.7.0",
]
Expand All @@ -22,7 +22,7 @@ readme = "README.md"
requires-python = ">=3.9"
dependencies = [
"numpy",
"pydisort>=1.4.1",
"pydisort>=1.4.5",
]
classifiers = [
"Development Status :: 4 - Beta",
Expand Down
3 changes: 3 additions & 0 deletions src/integrator/integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ struct IntegratorOptionsImpl {
static std::shared_ptr<IntegratorOptionsImpl> from_yaml(
YAML::Node const& node, bool verbose = false);

std::shared_ptr<IntegratorOptionsImpl> clone() const {
return std::make_shared<IntegratorOptionsImpl>(*this);
}
void report(std::ostream& os) const {
os << "* type = " << type() << "\n"
<< "* cfl = " << cfl() << "\n"
Expand Down
3 changes: 3 additions & 0 deletions src/opacity/opacity_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ struct OpacityOptionsImpl {
std::string const& filename, std::string const& op_name,
std::string bd_name = "");

std::shared_ptr<OpacityOptionsImpl> clone() const {
return std::make_shared<OpacityOptionsImpl>(*this);
}
void report(std::ostream& os) const {
os << "* type = " << type() << "\n";
os << "* bname = " << bname() << "\n";
Expand Down
7 changes: 7 additions & 0 deletions src/radiation/radiation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ struct RadiationOptionsImpl {
static std::shared_ptr<RadiationOptionsImpl> from_yaml(
std::string const& filename);

std::shared_ptr<RadiationOptionsImpl> clone() const {
auto op = std::make_shared<RadiationOptionsImpl>(*this);
for (auto& b : op->bands()) {
b = b->clone();
}
return op;
}
void report(std::ostream& os) const {
os << "* outdirs = " << outdirs() << "\n";
os << "* [ bands:\n";
Expand Down
38 changes: 29 additions & 9 deletions src/radiation/radiation_band.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <disort/disort.hpp>

// harp
#include <harp/harp_formatter.hpp>
#include <harp/opacity/opacity_options.hpp>
#include <harp/rtsolver/toon_mckay89.hpp>

Expand Down Expand Up @@ -66,6 +67,21 @@ struct RadiationBandOptionsImpl {
static std::shared_ptr<RadiationBandOptionsImpl> from_yaml(
std::string const& filename, std::string const& bd_name);

std::shared_ptr<RadiationBandOptionsImpl> clone() const {
auto op = std::make_shared<RadiationBandOptionsImpl>(*this);
if (op->disort() != nullptr) {
op->disort() = op->disort()->clone();
}
if (op->toon() != nullptr) {
op->toon() = op->toon()->clone();
}
auto& opacities_ref = op->opacities();
opacities_ref.clear();
for (auto const& [k, v] : opacities()) {
opacities_ref[k] = v->clone();
}
return op;
}
void report(std::ostream& os) const {
os << "* name = " << name() << "\n";
os << "* outdirs = " << outdirs() << "\n";
Expand All @@ -75,20 +91,24 @@ struct RadiationBandOptionsImpl {
os << "* ncol = " << ncol() << "\n";
os << "* nlyr = " << nlyr() << "\n";
os << "* nstr = " << nstr() << "\n";
os << "* [ opacities:\n";

os << "* opacities: [\n";
for (auto const& [k, v] : opacities()) {
os << " - " << k << ":\n";
v->report(os);
}
os << " ]\n";
os << "* disort:\n";
disort()->report(os);
os << "* wavenumber = [";
for (auto const& w : wavenumber()) os << w << ", ";
os << "]\n";
os << "* weight = [ ";
for (auto const& w : weight()) os << w << ", ";
os << "]\n";

if (solver_name() == "disort") {
os << "* disort:\n";
disort()->report(os);
} else if (solver_name() == "toon") {
os << "* toon:\n";
toon()->report(os);
}

os << "* wavenumber = " << fmt::format("{}", wavenumber()) << "\n";
os << "* weight = " << fmt::format("{}", weight()) << "\n";
os << "* verbose = " << (verbose() ? "true" : "false") << "\n";
}

Expand Down
3 changes: 3 additions & 0 deletions src/rtsolver/toon_mckay89.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ struct ToonMcKay89OptionsImpl {
return std::make_shared<ToonMcKay89OptionsImpl>();
}

std::shared_ptr<ToonMcKay89OptionsImpl> clone() const {
return std::make_shared<ToonMcKay89OptionsImpl>(*this);
}
void report(std::ostream& os) const {
os << "* zenith_correction = " << zenith_correction() << "\n";

Expand Down
Loading