Skip to content

Commit

Permalink
Getting closer to a good implementation of basic weightings
Browse files Browse the repository at this point in the history
  • Loading branch information
tennlee committed Aug 23, 2023
1 parent f396bc0 commit 7499116
Show file tree
Hide file tree
Showing 2 changed files with 707 additions and 14 deletions.
11 changes: 11 additions & 0 deletions src/scores/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,14 @@ def check_dims(xr_data, expected_dims, mode=None):
f"Dimensions {list(xr_data[data_var].dims)} of data variable "
f"'{data_var}' are not {mode} to the dimensions {sorted(dims_set)}"
)


def create_latitude_weights(latitudes):
'''
A common way of weighting errors is to make them proportional to the amount of area
which is contained in a particular region. This is approximated by the cosine
of the latitude on an LLXY grid. Nuances not accounted for include the variation in
latitude across the region, or the irregularity of the surface of the earth.
'''
weights = np.cos(np.deg2rad(latitudes))
return weights
Loading

0 comments on commit 7499116

Please sign in to comment.