TNO Intern

Commit 8d2ca37b authored by Arjo Segers's avatar Arjo Segers
Browse files

Define lon/lat axes of gridded output as floats.

parent b219fa8e
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@
# 2023-08, Arjo Segers
#   Reformatted using 'black'.
#
# 2023-08, Arjo Segers
#    Define lon/lat axes as dtype f4.
#


########################################################################
@@ -280,13 +283,13 @@ class CSO_GriddedAverage(utopya.UtopyaRc):

        # centers:
        da_lons = xarray.DataArray(
            west + (numpy.arange(nlon) + 0.5) * dlon,
            numpy.array(west + (numpy.arange(nlon) + 0.5) * dlon, dtype="f4"),
            dims=("longitude",),
            attrs={"units": "degrees_east", "standard_name": "longitude"},
        )
        # centers:
        da_lats = xarray.DataArray(
            south + (numpy.arange(nlat) + 0.5) * dlat,
            numpy.array(south + (numpy.arange(nlat) + 0.5) * dlat, dtype="f4"),
            dims=("latitude",),
            attrs={"units": "degrees_north", "standard_name": "latitude"},
        )
@@ -489,7 +492,7 @@ class CSO_GriddedAverage(utopya.UtopyaRc):
                    # empty? then leave:
                    if len(xdf) == 0:
                        # info ..
                        logging.info(indent + "    no file(s) found for this time ...")
                        logging.info(indent + "    no source file(s) found for this time ...")
                        # next time step:
                        continue
                    # endif
@@ -517,14 +520,20 @@ class CSO_GriddedAverage(utopya.UtopyaRc):

                    # data files including footprints:
                    datafiles = glob.glob(infile_curr)
                    # empty? then leave:
                    if len(datafiles) == 0:
                        # info ..
                        logging.info(indent + "    no source file(s) found for this time ...")
                        # next time step:
                        continue
                    # endif

                    # sorted:
                    datafiles.sort()

                    # info ..
                    logging.info(
                        indent
                        + "    found %i file(s) matching: %s" % (len(datafiles), infile_curr)
                    )
                    logging.info(indent + "    found %i file(s) matching: %s"
                                     % (len(datafiles), infile_curr) )

                # endif # listing or filenames