-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Vcmax to support SpaceVaryingInput #744
Conversation
1b89316
to
7165e69
Compare
7165e69
to
2755c4f
Compare
2755c4f
to
1d4db35
Compare
1d4db35
to
b76c664
Compare
FarquharParameters now also supports Vcmax25 of type ClimaCore.Fields.Field. In relevant tests, Vcmax25 is changed from a float to a field that contains the previous Vcmax25 value everywhere. Both longrun and benchmark Land.jl now use the Vcmax map from clm_data.
b76c664
to
5a015dc
Compare
@@ -166,7 +166,9 @@ function FarquharParameters( | |||
parameters = CP.get_parameter_values(toml_dict, name_map, "Land") | |||
FT = CP.float_type(toml_dict) | |||
MECH = typeof(mechanism) | |||
return FarquharParameters{FT, MECH}(; | |||
Vcmax25 = FT.(Vcmax25) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this FT? If Vcmax25 is a field, it should already be made on the space of the simulation and be the right type. If it is a scalar, this definition in the FarquharParameter struct VC <: Union{FT, ClimaCore.Fields.Field}
should ensure it is the same type as the other scalars.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Julia did not want to perform conversion from scalars to a union of a scalar and a non-scalar. If I remove line 169 the tests fail with
TypeError: in FarquharParameters, in VC, expected VC<:Union{Float32, ClimaCore.Fields.Field}, got Type{Float64}
. Additionally, if I try converting from a scalar to Union{FT, ClimaCore.Fields.Field}
I get
MethodError: Cannot convert an object of type Float64 to an object of type Union{Float32, ClimaCore.Fields.Field}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thank you!
We must already broadcast over functions with VCmax25 in Canopy.jl, since that didnt need to change?
Make sure to add an entry to the NEWS file too. When you do so, it is nice if you can showcase the new feature you have added (see, e.g., how we do it in ClimaAnalysis). |
beautiful! thanks @imreddyTeja |
Purpose
FarquharParameters now also supports Vcmax25 of type ClimaCore.Fields.Field. In relevant tests, Vcmax25 is changed from a float to a field that contains the previous Vcmax25 value everywhere. Both longrun and benchmark Land.jl now use the Vcmax map from clm_data.
Closes #723
PR also contains whitespace removal.
To-do
Content
FarquharParameters
takes aVcmax25
of typeF <: Union{<: AbstractFloat, ClimaCore.Field}
Land.jl
benchmark and long run uses the vcmax map from clm_data. Map can be seen below.Vcmax25
.Example output of
experiments/long_runs/land.jl
Previously:
After changing Vcmax25 to the clm_data map: