Skip to content

Commit

Permalink
Merge pull request #401 from CliMA/aj/ml_total_activated
Browse files Browse the repository at this point in the history
Add total activated number to ML extension
  • Loading branch information
trontrytel authored May 22, 2024
2 parents 0592ce2 + a4ffd88 commit 85e6472
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ext/EmulatorModelsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,35 @@ function AA.N_activated_per_mode(
end
end

"""
total_N_activated(machine, ap, ad, aip, tps, T, p, w, q)
- `machine` - ML model
- `ap` - a struct with aerosol activation parameters
- `ad` - aerosol distribution struct
- `aip` - a struct with air properties
- `tps` - a struct with thermodynamics parameters
- `T` - air temperature
- `p` - air pressure
- `w` - vertical velocity
- `q` - phase partition
Returns the total number of activated aerosol particles by using a trained emulator.
"""
function AA.total_N_activated(
machine::MLJ.Machine,
ap::CMP.AerosolActivationParameters,
ad::CMP.AerosolDistributionType,
aip::CMP.AirProperties,
tps::TDP.ThermodynamicsParameters,
T::FT,
p::FT,
w::FT,
q::TD.PhasePartition{FT},
) where {FT}
return sum(AA.N_activated_per_mode(machine, ap, ad, aip, tps, T, p, w, q))
end

"""
AerosolActivationParameters(ekp_params)
Expand Down
3 changes: 3 additions & 0 deletions test/aerosol_activation_emulators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ function test_emulator(
TT.@test AA.N_activated_per_mode(mach, ap, ad, aip, tps, T, p, w, q)[2]
AA.N_activated_per_mode(ap, ad, aip, tps, T, p, w, q)[2] rtol =
rtols[2]
TT.@test AA.total_N_activated(mach, ap, ad, aip, tps, T, p, w, q)
AA.total_N_activated(ap, ad, aip, tps, T, p, w, q) rtol = rtols[2]

end

@info "Aerosol activation test"
Expand Down

2 comments on commit 85e6472

@trontrytel
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/107442

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.20.2 -m "<description of version>" 85e6472fb00974ffb7dc235cd6e742b94623e112
git push origin v0.20.2

Please sign in to comment.