Hi,

I'm trying to calculate the area-weighted mean inside OpenIFS using the following:

IFS_array(klon)

IFS_lat(klon)

sumx = 0.0

sumwgt = 0.0

Using the cosine weights, and the latitude is defined in radians:

do jl = kidia,kfdia

   sumx = sumx + IFS_array(jl) * cos(IFS_lat(jl))

   sumwgt = sumwgt + cos(IFS_lat(jl))

end do

area_weighted_mean = sumx/sumwgt

I'm wondering is this method is ok to use in OpenIFS given the reduced gaussian grid?

Appreciate your thoughts on this,

/M


4 Comments

  1. Hi Marston,

    I don't get your point. Why would you use the cos of latitude as a weight?

    Doing this you may find that your "average" gives more weights to equatorial areas over the polar caps. This however could only work when your area associated with a grid-point follow the cosinus function. I am not sure this is the case in lat-lon. And it is certainly not the case in reduced Gaussian grid.

    Are you sure this is what you want?

    Filip





    1. Hi Filip,

      Thanks for replying. I'm using the cosine of the latitude as a weight. It is what I used in NCL when I do area weighting on a regular lat lon grid. I suspected that this might not work inside IFS on a reduced Gaussian grid. But now you have answered my question: it will not work.

      My next question is how can I do the area-weighting inside IFS on the KLON level of decomposition?
      Here's the scenario: I have several arrays in IFS that are defined: A(KLON,7,7). I would like to get the area-weighted mean of A that would give me array B(7,7), i.e., B = area_weight_mean(A, dim=1). Also, I'm applying this area-weights to variables that are defined where sunlit is 1 as well as to variables that are defined globally. Since I'm doing this averaging on the KLON level, the results are written to netcdf files where each file corresponds to a single processor. So I will have NPROC netcdf files. Postprocessing then includes the averaging of these files to get the global (sunlit) area-weighted mean of the variables in question.

      I thought about several ways of doing this but the reduced Gaussian grid is a special case, and then I don't know if I need to take into account, for example HALO, or how to compute the weights.

      Could you please give me some advise on how to achieve this - if it is possible?

      Hope I'm a bit clearer.

      /M

  2. Hi Marston,

    The prerequisite to do any such averaging inside the decomposed NPROMA chunks is to have a weight.

    We do have something like that in the IFS called YYDGEOMETRY%YRGSGEOM(IBL)%GAW(1:ICEND) (Indeed it could be different name in different model releases. So search for the %GAW.) With this parameter (renamed here as PGAW) you can get a grid box area in km**2:

    ZAREA(KIDIA:KFDIA)=1.0E-6_JPRB*4.0_JPRB*RPI*RA*RA*PGAW(KIDIA:KFDIA)

    Having this plus knowing the coverage of the whole globe (trivial) you can weight your fields. Still, don't forget that the final summations from those intermediate results of NPROMA chunks should be better done on single processor. You may check it by weighting a constant field first. If the results is the original value your method works correctly.

    Note also that averaging is subject by used precision. From this point of view it is preferable to do it for smaller areas which are gradually cumulated into one final sum.

    At ECMWF we usually do an averaging offline, i.e. outside the parallel execution of the IFS.

    Cheers,

    Filip



    1. Hi Filip!

      Thanks for all your help. I used the area as you wrote and saved the cumulative variable*area as well as the cumulative of the area of the valid cells. This is done on each processor and saved to netcdf files. Then outside of IFS (offline) I summed the processors and then divide by the area. When I tested this method by setting the variable to 1 and the weighted mean was 1. The end results looked very good and agrees with the observations and other models.

      Appreciate your help with this (smile)
      /M