[Met_help] [rt.rap.ucar.edu #91925] History for formulation of cosine-latitude weighting
John Halley Gotway via RT
met_help at ucar.edu
Wed Apr 1 10:46:02 MDT 2020
----------------------------------------------------------------
Initial Request
----------------------------------------------------------------
Following up from a side conversation at the MET tutorial at NRL-Monterey in July:
In our ongoing effort to reconcile our cosine-latitude weighting with MET's cosine-laitude weighting, I have attempted to infer the MET formulation of the cosine-latitude weighting from looking at the routine "vx_regrid.cc". However, this hasn't proven to be easy.
We have also checked the User Guide and the weighting formulation is not provided. There is a verbal description, but this is insufficient in detail.
Can someone at MET provide me with the mathematical formula that MET is using for the cosine-latitude weighting? I'm talking about the equation itself, including the normalization step.
I think this is the only way to be sure that I know exactly how MET applies the weighting.
Sincerely,
Justin McLay
Justin McLay, PhD
Meteorologist, Code 7532
Marine Meteorology Division
Naval Research Laboratory
7 Grace Hopper Ave., Mail Stop 2
Monterey CA 93943
831-656-4837
----------------------------------------------------------------
Complete Ticket History
----------------------------------------------------------------
Subject: formulation of cosine-latitude weighting
From: John Halley Gotway
Time: Fri Sep 06 10:19:06 2019
Hi Justin,
The cosine latitude weights are computed in the function named
"parse_grid_weight()" which begins on line 116 of the file
"apply_mask.cc":
https://github.com/NCAR/MET/blob/master_v8.1/met/src/libcode/vx_statistics/apply_mask.cc
The code loops over each (x, y) grid point, determines the
corresponding
latitude for that point, and computes the cosine of that latitude as
the
weight for that grid point:
129 if(t == GridWeightType_Cos_Lat) {
130 grid.xy_to_latlon(x, y, lat, lon);
131 w = cosd(lat);
132 }
As for the normalization step, for each matched pair, we keep track of
several values:
forecast value, observation value, climatological mean,
climatological
standard deviation, and grid point weight value (in this case, the
cosine
of the latitude)
And the normalization is done when computing the statistics. For
example,
when computing continuous stats, like RMSE, MAE, and ME, this is done
in
the function named "compute_cntinfo()" which begins on line 3252 of
the
file "met_stats.cc":
https://github.com/NCAR/MET/blob/master_v8.1/met/src/libcode/vx_statistics/met_stats.cc
This function is called once for each "verification task". So let's
say
you're verifying 500mb height over 8 different geographic regions.
This
function would be called 8 times, once for each region, with a
different
group of fcst/obs matched pairs each time. The normalization of the
weights is done separately for each set of matched pairs.
We compute the sum of the weights for the current set of matched
pairs:
3281 //
3282 // Get the sum of the weights
3283 //
3284 w_sum = w_na.sum();
While looping over the matched pairs, we normalize by dividing the
weight
for the current grid point by the sum of the weights:
3303 w = w_na[i]/w_sum;
Then we apply that normalized weight to the partial sums that are
computed:
3317 f_bar += w*f;
3318 o_bar += w*o;
3319 ff_bar += w*f*f;
3320 oo_bar += w*o*o;
3321 fo_bar += w*f*o;
3322 err_bar += w*err;
3323 abs_err_bar += w*fabs(err);
3324 err_sq_bar += w*err*err;
And the actual stats are derived from those normalized partial sums...
for
example, computing the mean error and the standard deviation of the
error:
3410 //
3411 // Compute mean error and standard deviation of the mean error
3412 //
3413 cnt_info.me.v = err_bar;
3414 cnt_info.estdev.v = compute_stdev(n*err_bar, n*err_sq_bar, n);
Hope that helps clarify the logic.
Thanks,
John
On Thu, Sep 5, 2019 at 3:55 PM McLay, Dr. Justin via RT
<met_help at ucar.edu>
wrote:
>
> Thu Sep 05 15:54:38 2019: Request 91925 was acted upon.
> Transaction: Ticket created by Justin.McLay at nrlmry.navy.mil
> Queue: met_help
> Subject: formulation of cosine-latitude weighting
> Owner: Nobody
> Requestors: Justin.McLay at nrlmry.navy.mil
> Status: new
> Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=91925 >
>
>
> Following up from a side conversation at the MET tutorial at NRL-
Monterey
> in July:
>
> In our ongoing effort to reconcile our cosine-latitude weighting
with
> MET's cosine-laitude weighting, I have attempted to infer the MET
> formulation of the cosine-latitude weighting from looking at the
routine
> "vx_regrid.cc". However, this hasn't proven to be easy.
>
> We have also checked the User Guide and the weighting formulation is
not
> provided. There is a verbal description, but this is insufficient
in
> detail.
>
> Can someone at MET provide me with the mathematical formula that MET
is
> using for the cosine-latitude weighting? I'm talking about the
equation
> itself, including the normalization step.
>
> I think this is the only way to be sure that I know exactly how MET
> applies the weighting.
>
> Sincerely,
> Justin McLay
>
>
>
> Justin McLay, PhD
> Meteorologist, Code 7532
> Marine Meteorology Division
> Naval Research Laboratory
> 7 Grace Hopper Ave., Mail Stop 2
> Monterey CA 93943
> 831-656-4837
>
>
>
------------------------------------------------
Subject: RE: [rt.rap.ucar.edu #91925] formulation of cosine-latitude weighting
From: McLay, Dr. Justin
Time: Fri Sep 06 14:19:30 2019
Thanks John for the quick response. I'm confident now as to why our
results are systematically smaller than the MET results. Consistent
with my suspicion, it's because we differ in how we normalize.
We normalize simply by the total count of the grid points within our
region of interest. I.e. if N is the total count of the grid points
within our region, then our normalization = N * (1.).
Written this way, one can see that our normalization is equivalent to
normalizing by the sum of the weights for the isolated case where the
weights are all equal to 1.
Met, on the other hand, normalizes by the sum of the cosine-latitude
weights. Since the cosine-latitude weights are all <= 1, by
definition, your normalization value (call it M) must be smaller than
ours, i.e. M <= N.
It follows that our final, normalized score must be smaller than the
MET normalized score, because we are dividing by a larger value than
MET is.
i.e. if X is the quantity we are normalizing then X/N <= X/M.
Thanks again,
Justin
-----Original Message-----
From: John Halley Gotway via RT [mailto:met_help at ucar.edu]
Sent: Friday, September 6, 2019 9:19 AM
To: McLay, Dr. Justin
Subject: Re: [rt.rap.ucar.edu #91925] formulation of cosine-latitude
weighting
Hi Justin,
The cosine latitude weights are computed in the function named
"parse_grid_weight()" which begins on line 116 of the file
"apply_mask.cc":
https://github.com/NCAR/MET/blob/master_v8.1/met/src/libcode/vx_statistics/apply_mask.cc
The code loops over each (x, y) grid point, determines the
corresponding
latitude for that point, and computes the cosine of that latitude as
the
weight for that grid point:
129 if(t == GridWeightType_Cos_Lat) {
130 grid.xy_to_latlon(x, y, lat, lon);
131 w = cosd(lat);
132 }
As for the normalization step, for each matched pair, we keep track of
several values:
forecast value, observation value, climatological mean,
climatological
standard deviation, and grid point weight value (in this case, the
cosine
of the latitude)
And the normalization is done when computing the statistics. For
example,
when computing continuous stats, like RMSE, MAE, and ME, this is done
in
the function named "compute_cntinfo()" which begins on line 3252 of
the
file "met_stats.cc":
https://github.com/NCAR/MET/blob/master_v8.1/met/src/libcode/vx_statistics/met_stats.cc
This function is called once for each "verification task". So let's
say
you're verifying 500mb height over 8 different geographic regions.
This
function would be called 8 times, once for each region, with a
different
group of fcst/obs matched pairs each time. The normalization of the
weights is done separately for each set of matched pairs.
We compute the sum of the weights for the current set of matched
pairs:
3281 //
3282 // Get the sum of the weights
3283 //
3284 w_sum = w_na.sum();
While looping over the matched pairs, we normalize by dividing the
weight
for the current grid point by the sum of the weights:
3303 w = w_na[i]/w_sum;
Then we apply that normalized weight to the partial sums that are
computed:
3317 f_bar += w*f;
3318 o_bar += w*o;
3319 ff_bar += w*f*f;
3320 oo_bar += w*o*o;
3321 fo_bar += w*f*o;
3322 err_bar += w*err;
3323 abs_err_bar += w*fabs(err);
3324 err_sq_bar += w*err*err;
And the actual stats are derived from those normalized partial sums...
for
example, computing the mean error and the standard deviation of the
error:
3410 //
3411 // Compute mean error and standard deviation of the mean error
3412 //
3413 cnt_info.me.v = err_bar;
3414 cnt_info.estdev.v = compute_stdev(n*err_bar, n*err_sq_bar, n);
Hope that helps clarify the logic.
Thanks,
John
On Thu, Sep 5, 2019 at 3:55 PM McLay, Dr. Justin via RT
<met_help at ucar.edu>
wrote:
>
> Thu Sep 05 15:54:38 2019: Request 91925 was acted upon.
> Transaction: Ticket created by Justin.McLay at nrlmry.navy.mil
> Queue: met_help
> Subject: formulation of cosine-latitude weighting
> Owner: Nobody
> Requestors: Justin.McLay at nrlmry.navy.mil
> Status: new
> Ticket <URL:
https://rt.rap.ucar.edu/rt/Ticket/Display.html?id=91925 >
>
>
> Following up from a side conversation at the MET tutorial at NRL-
Monterey
> in July:
>
> In our ongoing effort to reconcile our cosine-latitude weighting
with
> MET's cosine-laitude weighting, I have attempted to infer the MET
> formulation of the cosine-latitude weighting from looking at the
routine
> "vx_regrid.cc". However, this hasn't proven to be easy.
>
> We have also checked the User Guide and the weighting formulation is
not
> provided. There is a verbal description, but this is insufficient
in
> detail.
>
> Can someone at MET provide me with the mathematical formula that MET
is
> using for the cosine-latitude weighting? I'm talking about the
equation
> itself, including the normalization step.
>
> I think this is the only way to be sure that I know exactly how MET
> applies the weighting.
>
> Sincerely,
> Justin McLay
>
>
>
> Justin McLay, PhD
> Meteorologist, Code 7532
> Marine Meteorology Division
> Naval Research Laboratory
> 7 Grace Hopper Ave., Mail Stop 2
> Monterey CA 93943
> 831-656-4837
>
>
>
------------------------------------------------
More information about the Met_help
mailing list