TNO Intern

Commit 45374b1f authored by Arjo Segers's avatar Arjo Segers
Browse files

Changed insert of new columns to dataframe after efficiency warning.

parent fe5cba49
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -452,3 +452,10 @@ v2.9.5
Changed size calculation after deprication warning.
  py/cso_superobs.py
  py/cso_colocate.py

v2.9.6
~~~~~~

Changed insert of new columns to dataframe after efficiency warning.
  py/cso_superobs.py
+6 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#
# 2024-11, Arjo Segers
#   Changed size calculation after deprication warning.
#   Changed insert of new columns to dataframe after efficiency warning.
#


@@ -488,6 +489,8 @@ class CSO_SuperObs(utopya.UtopyaRc):
                        else:
                            values = source_file.ds[vkey].values[iipix, :].reshape((npix, nv))
                        # endif
                        # storage for new columns:
                        xdf = pandas.DataFrame()
                        # loop over data values:
                        for iv in range(nv):
                            # column name:
@@ -496,8 +499,10 @@ class CSO_SuperObs(utopya.UtopyaRc):
                            # the '*' product gives an element-wise product of wwp (np,npix)
                            # and the values (npix) with result shaped (np,npix);
                            # after flattening, result has length np*npix :
                            df[ckey] = (wwp * values[:, iv]).flatten()
                            xdf[ckey] = (wwp * values[:, iv]).flatten()
                        # endfor  # iv
                        # add columns to existing storage:
                        df = pandas.concat((df, xdf), axis=1)
                    # endif  # time or other values

                # endfor # source variables