-
Notifications
You must be signed in to change notification settings - Fork 13
Move forcing script from fluxnet experiments to src #1238
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
base: main
Are you sure you want to change the base?
Conversation
site_ID = ARGS[1] | ||
site_ID = "US-MOz" |
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.
We should revert this before merging
@@ -53,8 +56,10 @@ ClimaTimeSteppers = "0.8" | |||
ClimaUtilities = "0.1.24" | |||
DataFrames = "1.4" | |||
Dates = "1" | |||
DelimitedFiles = "1" |
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 thought these packages would go under weakdeps
rather than compat
since they're used by the extension. I don't find very good Julia documentation about how to set up package extensions, but I did find this example repo someone made: https://github.com/pebeto/julia_extensions_example/tree/main
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.
You should be able to add a weak dependency with Pkg.add(name_of_package, target=:weakdeps)
.
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 is what I did (then package name and uuid is listed under weak deps). However the compat is separate from that.
We are not required to list compats for weak dependencies, but one of the Aqua tests checks that (we can disable it if we want). If we do want to list compats, though, there is not weak_compats - all compats are in a single list.
Our extensions have added compat in the past (Neural Snow - Flux, LandSimulationVisualization (very recently) - Poppler, Printf, etc)
|
||
[deps.ClimaLand.extensions] | ||
FluxnetSimulations = ["DelimitedFiles", "Format"] |
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.
Would it be possible to remove Format
as a dependency? It seems strange to me to include a package that just handle string formatting?
FluxnetSimulations = | ||
Base.get_extension(ClimaLand, :FluxnetSimulations).FluxnetSimulations; | ||
|
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 am not sure if this work, but can you try
FluxnetSimulations = | |
Base.get_extension(ClimaLand, :FluxnetSimulations).FluxnetSimulations; | |
import ClimaLand.FluxnetSimulations as FluxnetSimulations |
function mask_data(t, v; val = -9999) | ||
if ndims(v) == 1 | ||
not_missing_mask = .~var_missing.(v) |
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.
val
isn't used in this function.
var_missing(array; val = -9999) = array == val | ||
|
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.
Could documentation be added to all the functions in this file?
Float64.(t), | ||
Float64.(preprocess_func.(eachcol(v)...)), |
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.
Is there a reason why this need to be Float64
?
if any(indices .== nothing) | ||
nothing_id = findall(indices .== nothing) | ||
@error("$(labels[nothing_id]) is missing in the data, but required.") | ||
end |
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.
if any(indices .== nothing) | |
nothing_id = findall(indices .== nothing) | |
@error("$(labels[nothing_id]) is missing in the data, but required.") | |
end | |
nothing_id = findall(indices .== nothing) | |
if !isempty(nothing_id) | |
@error("$(labels[nothing_id]) is missing in the data, but required.") | |
end |
@@ -532,11 +500,11 @@ lines!( | |||
label = "Ice, 1.25cm", | |||
) | |||
|
|||
if drivers.SWC.status != absent | |||
if comparison_data.SWC.absent == false |
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.
if comparison_data.SWC.absent == false | |
if !comparison_data.SWC.absent |
@@ -599,11 +562,11 @@ lines!( | |||
color = "blue", | |||
) | |||
|
|||
if drivers.TS.status != absent | |||
if comparison_data.TS.absent == false |
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.
if comparison_data.TS.absent == false | |
if !comparison_data.TS.absent |
) | ||
first_row = skip_header ? 2 : 1 | ||
idx = column_name_map[varname] | ||
if idx isa Nothing |
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.
if idx isa Nothing | |
if isnothing(idx) |
varnames = ("TA_F", "VPD_F", "PA_F", "P_F", "WS_F", "LW_IN_F", "SW_IN_F") | ||
indices = [findfirst(columns .== varname) for varname in varnames] | ||
column_name_map = Dict(zip(varnames, indices)) |
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.
varnames = ("TA_F", "VPD_F", "PA_F", "P_F", "WS_F", "LW_IN_F", "SW_IN_F") | |
indices = [findfirst(columns .== varname) for varname in varnames] | |
column_name_map = Dict(zip(varnames, indices)) | |
varnames = ("TA_F", "VPD_F", "PA_F", "P_F", "WS_F", "LW_IN_F", "SW_IN_F") | |
colimn_name_map = Dict(varname => findfirst(columns .== varname) for varname in varnames) |
Purpose
Attempts to clean up our fluxnet simulations. It mostly moves stuff into src but there is probably further cleanup to be had.
It would be nice to pass dates or Itime to TVI but this does not currently work
It would be nice to be able to pass a preprocess function to TVI but this does not currently work, so I do unit changes by hand
Another cool thing would be if we could have TVI read a CSV and get the right column but Im not sure if that is worth it (rather than me reading in the csv and passing arrays to TVI)
To-do
Figure out how to handle to comparison to data in the output...
move plotting to LandSimulationVisualization extension
Content