CliMA / CliMA/ClimaAnalysis.jl

Constructing OutputVar from a function

Open
#265 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
12
Forks
5
Avg merge
7d 2h
Merged PRs (30d)
2

Description

It may be helpful to provide a constructor for making `OutputVar` using a function.

For example, when computing the covariance matrix for calibration, you can add latitude weights by computing 1 / lat and flattening the data. See the example below of this.

```
function lat_weight_mat(output_var::OutputVar)
lon_size, lat_size = size(output_var.data)[1:2]
lat_weights = zeros(Float32, lon_size, lat_size)
for i in 1:lon_size
for j in 1:lat_size
lat_weights[i, j] = 1.0f0 ./ max(cosd(ClimaAnalysis.latitudes(output_var)[j]), 0.1)
end
end
return lat_weights
end
```

It would be helpful to provide a function that allow the user to pass in their own function to construct `OutputVar`s from.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the OutputVar definition and any existing constructors, then inspect how the latitude-weighting example would supply a function and its inputs. Done means a documented function-based construction path exists for OutputVar and its behavior is covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.