Skip to content
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

computed_fields for SyntheticObservations #216

Open
glwagner opened this issue Feb 21, 2022 · 1 comment
Open

computed_fields for SyntheticObservations #216

glwagner opened this issue Feb 21, 2022 · 1 comment
Labels
🤥 enhancement New feature or request

Comments

@glwagner
Copy link
Member

Say that I want to calibrate CATKE using the mismatch between the gradient of observed and modeled TKE, rather than the absolute value. This is reasonable if we really care about the "shape" of the profile, rather than its absolute magnitude.

For this I think we can allow users to specify transformations on data that get loaded into field_time_series. This is what it might look like:

dz_e = Computation(e -> ∂z(e), inputs=:e)

obs = SyntheticObservations(data_path, field_names=(:b, :e), computed_fields=(; dz_e))

For shear we might write

shear = Computation((u, v) -> sqrt(∂z(u)^2 + ∂z(v)^2), inputs=(:u, :v))
obs = SyntheticObservations(data_path, field_names=(:b, :e), computed_fields=(; dz_e, shear))

under the hood, we can first load the "file-based" FieldTimeSeries, and then use that data to make the list of computed_fields. The first argument to Computation is a function that transforms dependencies (one of or a list of the fields that were loaded from file) into another field or abstract operation.

It's probably also possible to design a macro that allows us to write (since the code gives us the names of the inputs.

shear = @computation (u, v) -> sqrt(∂z(u)^2 + ∂z(v)^2)
@glwagner glwagner added the 🤥 enhancement New feature or request label Feb 21, 2022
@glwagner
Copy link
Member Author

Or even better something like

computed_fields = @computations begin
    shear(u, v) = sqrt(∂z(u)^2 + ∂z(v)^2)
    dz_e(e) = ∂z(e)
end

obs = SyntheticObservations(data_path; field_names=(:b, :e), computed_fields)

Maybe overkill but fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤥 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant