TNO Intern

Commit b994e7a1 authored by Arjo Segers's avatar Arjo Segers
Browse files

Updated documentation.

parent 6d63d3b2
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@
# 2025-04, Arjo Segers
#   Changed imports for python packaging.
#
# 2026-01, Arjo Segers
#   Fixed escape characters in (document) strings.
#


########################################################################
@@ -282,7 +285,7 @@ class CSO_CoLocate(utopya.UtopyaRc):
        loc_lat = self.GetSetting("locations.latitude")
        # read:
        locations = pandas.read_csv(
            locations_file, sep="\s*" + sep + "\s*", engine="python", comment=comment
            locations_file, sep=f"\\s*{sep}\\s*", engine="python", comment=comment
        )
        # count:
        nloc = len(locations)
+2 −1
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@
#
# 2026-01, Arjo Segers
#   Updated use of Dataset.dims following deprication warning.
#   Removed whitespace from template replacement.
#

########################################################################
@@ -1666,7 +1667,7 @@ class CSO_Listing(object):
                # to:
                #    df['orbit'] == '12345'
                for key in self.df.keys():
                    selection = selection.replace(f"%{{{key}}}", f"df['{key}']")
                    selection = selection.replace(f"%{{{key}}}", f"df['{key}']").strip()
                # endfor
                # testing ...
                logging.info(f"{indent}selection `{selection}` ...")
+7 −5
Original line number Diff line number Diff line
@@ -41,6 +41,9 @@
#   Updated calculation of temporal means for files with time records.
#
# 2026-01, Arjo Segers
#   Fixed escape characters in (document) strings.
#
# 2026-01, Arjo Segers
#   Fixed timerange setup.
#

@@ -113,15 +116,15 @@ class CSO_GriddedAverage(utopya.UtopyaRc):
    using the total overlapping area:

    .. math::
        x(i_k,j_k) ~=~ \left(\ \sum\limits_{p\in P_k} y_p\ w_{p,k}\ \\right)\ /\ \sum\limits_{p\in P_k}\ w_{p,k}
        x(i_k,j_k) ~=~ \\left(\\ \\sum\\limits_{p\\in P_k} y_p\\ w_{p,k}\\ \\right)\\ /\\ \\sum\\limits_{p\\in P_k}\\ w_{p,k}

    where:

    * :math:`i_k,j_k` are the indices of grid cell :math:`k`;
    * :math:`P_k` is the set of pixels that overlap with cell :math:`k`;
    * :math:`y_p` is the data value of pixel :math:`p`;
    * :math:`w_p` is the footprint area [m\ :sup:`2`] of pixel :math:`p`
    * :math:`w_{p,k}` is the area [m\ :sup:`2`] of pixel :math:`p` that overlaps with the cell :math:`k`.
    * :math:`w_p` is the footprint area [m\\ :sup:`2`] of pixel :math:`p`
    * :math:`w_{p,k}` is the area [m\\ :sup:`2`] of pixel :math:`p` that overlaps with the cell :math:`k`.

    The overlapping area is computed using the :py:meth:`LonLatPolygonCentroids <cso_mapping.LonLatPolygonCentroids>` method.
    This fractions a footprint area into a large number of triangles, and returns
@@ -630,7 +633,6 @@ class CSO_GriddedAverage(utopya.UtopyaRc):

                # array with total weights
                ww_out = numpy.zeros((nrec, nlat, nlon), dtype="f4")
                logging.info(f"{ww_out.shape=}")

                # loop over output records:
                for irec in range(nrec):
+9 −6
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@
# 2026-01, Arjo Segers
#   Changed imports for python packaging.
#
# 2026-01, Arjo Segers
#   Fixed escape characters in (document) strings.
#

########################################################################
###
@@ -165,13 +168,13 @@ def LonLatTrianglesArea(xx, yy):
     Using the radius :math:`R` of Earth (m) the area is:

     .. math::
         A ~=~ R^2 \int\limits_{x,y} \cos(y)\ dx\ dy
         A ~=~ R^2 \\int\\limits_{x,y} \\cos(y)\\ dx\\ dy

    Approximate this by first computing the area in degrees2
    and use the average latitude:

     .. math::
         A ~=~ R^2 \int\limits_{x,y} dx\ dy\ \cos(y_{aver})
         A ~=~ R^2 \\int\\limits_{x,y} dx\\ dy\\ \\cos(y_{aver})

    """

@@ -279,9 +282,9 @@ def LonLatPolygonCentroids(xx, yy, maxlevel=5, _level=0, indent=""):
    from with the sides of the polygon as base and the centroid as top::

          o---o
          |\ /|
          |\\ /|
          | * |
          |/ \|
          |/ \\|
          o---o

    Each triangle is devided into 2 new triangles with the middle of the longest side as their top
@@ -289,8 +292,8 @@ def LonLatPolygonCentroids(xx, yy, maxlevel=5, _level=0, indent=""):

              2
              o
          0 / | \ 2
          /   |   \
          0 / | \\ 2
          /   |   \\
        o-----*-----o
        0    1    1

+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@
# 2025-04, Arjo Segers
#   Changed imports for python packaging.
#
# 2026-03, Arjo Segers
#   Updated comment.
#

########################################################################
###
Loading