diff --git a/Makefile b/Makefile index 542d685756271fc787d8f9307e2675ddb404b41d..3071efdc11b285bad8bd9c21521c1a8db87be12b 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ help: # re-format python files, # use local maximum line-length convention .. black: - black --line-length=99 py doc/source/conf.py + black --line-length=99 src doc/source/conf.py # generate documentation: docu: diff --git a/doc/source/conf.py b/doc/source/conf.py index 3e6cc4cfd2c05ac8a992a66e200482ebc28041b6..0b0c855aa0c96d91a9f75431ec8313bd1665cd43 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,6 +12,7 @@ # import os import sys + # sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, os.pardir, "src"))) sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, os.pardir, "src", "utopya"))) @@ -35,12 +36,13 @@ if not os.path.isfile(ppfile): else: # modules: import toml + # open file: with open(ppfile, "r") as f: config = toml.load(f) # extrract: release = config["project"]["version"] -#endif +# endif # -- General configuration --------------------------------------------------- diff --git a/doc/source/history.rst b/doc/source/history.rst index 990ef51c92bc3dff217664bdb323005e4a7702db..d643e088f3df8dc0284432f545bd48a7d2a54651 100644 --- a/doc/source/history.rst +++ b/doc/source/history.rst @@ -159,7 +159,7 @@ A wishlist of developments. How to create a version tag =========================== -Example for tag "v2.11". +Example for tag "v2.12". 1. Update file formatting following conventions. @@ -177,21 +177,19 @@ Example for tag "v2.11". b. Update the source file `doc/source/history.rst <../../source/history.rst>`_ of this chapter. - c. Change the release tag that will be shown in the documentation in the file - `doc/source/conf.py <../../source/conf.py>`_:: + c. Change the release tag that will also be imported to the documenation in the `pyproject.toml <../../../pyproject.toml>`_ file:: - # The full version, including alpha/beta/rc tags - release = "v2.11" + release = "2.12" d. Commit and push these changes:: - git commit -m 'Defined v2.11' . + git commit -m 'Defined v2.12' . git push 4. Tag and push the code to the git repository:: - git tag -a 'v2.11' -m 'Tagged v2.11' - git push origin v2.11 + git tag -a 'v2.12' -m 'Tagged v2.12' + git push origin v2.12 diff --git a/src/cso/__init__.py b/src/cso/__init__.py index 020d635cabd5bc099117166b09361e6c0283c4df..401f8b064a7d893842ebd44f2eeaadbf3776fc94 100644 --- a/src/cso/__init__.py +++ b/src/cso/__init__.py @@ -109,6 +109,7 @@ and are defined according to the following hierchy: # store version number: from importlib import metadata + __version__ = metadata.version(__package__) # import entities from sub-modules: diff --git a/src/cso/cso_colhub.py b/src/cso/cso_colhub.py index 7d47ff19c8b84035b8b6fac0e04a42a6a02f01d2..1dc898925486c481b7c8817fa750c146bee78f16 100644 --- a/src/cso/cso_colhub.py +++ b/src/cso/cso_colhub.py @@ -422,13 +422,13 @@ class CSO_ColHubMirror_Missing(utopya.UtopyaRc): ) # read: listings_curr = [] - for listfile in listfiles : + for listfile in listfiles: # evaluate time templates if necessary: listfile = filedate.strftime(listfile) listfile = listfile.strip() # read: - listings_curr.append( cso_file.CSO_Listing(listfile) ) - #endfor + listings_curr.append(cso_file.CSO_Listing(listfile)) + # endfor # extract orbits: orbits = listing_all.GetValues("orbit").unique() @@ -467,11 +467,11 @@ class CSO_ColHubMirror_Missing(utopya.UtopyaRc): # set flag: found = False # loop over mirror listings: - for listing_curr in listings_curr : + for listing_curr in listings_curr: # check if already available: found = rec["filename"] in listing_curr # found? - if found : + if found: # info ... logging.info(f"{indent} file already present ...") # leave: @@ -488,7 +488,7 @@ class CSO_ColHubMirror_Missing(utopya.UtopyaRc): # endfor ## TESTING ... - #if len(listing) > 0 : + # if len(listing) > 0 : # logging.warning(f"BREAK!") # break ##endif diff --git a/src/cso/cso_file.py b/src/cso/cso_file.py index ee7024d35a09fe68d1a753787b260920bc7d2f94..09da2bb47385f4274a1d97fb52fe82649bb0f2df 100644 --- a/src/cso/cso_file.py +++ b/src/cso/cso_file.py @@ -93,9 +93,9 @@ def CheckDir(filename, dmode=None): # modules: import os - + # set creation mode: - if dmode is None : + if dmode is None: mode = 0o777 else: mode = dmode @@ -1293,10 +1293,10 @@ class CSO_Listing(object): index_col=self.index_label, dtype="str", ) - # convert datetime columns, as the default is "str" + # convert datetime columns, as the default is "str" # the "parse_dates" argument could not be used: - self.df["start_time"] = pandas.to_datetime( self.df["start_time"] ) - self.df["end_time"] = pandas.to_datetime( self.df["end_time"] ) + self.df["start_time"] = pandas.to_datetime(self.df["start_time"]) + self.df["end_time"] = pandas.to_datetime(self.df["end_time"]) else: # new table: @@ -1360,13 +1360,13 @@ class CSO_Listing(object): # * - def GetValue(self, filename, key ): + def GetValue(self, filename, key): """ Return ``key`` value for record of ``filename``. """ # copy: - return self.df.at[filename,key] + return self.df.at[filename, key] # enddef GetValue @@ -1379,7 +1379,7 @@ class CSO_Listing(object): """ # switch .. - if name is None : + if name is None: return self.df.index elif name in self.df.keys(): return self.df[name] diff --git a/src/cso/cso_inquire.py b/src/cso/cso_inquire.py index e3aedee2301af6509b8d897d126fb928d544f677..155cedef1c951a7338571d657379536d0aaeebd5 100644 --- a/src/cso/cso_inquire.py +++ b/src/cso/cso_inquire.py @@ -225,8 +225,8 @@ class CSO_Inquire_Plot(utopya.UtopyaRc): skip_blank_lines=True, dtype="str", ) - xdf["start_time"] = pandas.to_datetime( xdf["start_time"] ) - xdf["end_time"] = pandas.to_datetime( xdf["end_time"] ) + xdf["start_time"] = pandas.to_datetime(xdf["start_time"]) + xdf["end_time"] = pandas.to_datetime(xdf["end_time"]) # combine: if df is None: df = xdf diff --git a/src/cso/cso_s5p.py b/src/cso/cso_s5p.py index df5e4b4dff7926feb2cdab1c0e52b44c2f32f8a9..db73c1abeaec6f0dd3576ec08a641c97460713e1 100644 --- a/src/cso/cso_s5p.py +++ b/src/cso/cso_s5p.py @@ -1392,7 +1392,7 @@ class CSO_S5p_File(cso_file.CSO_File): # endif # base time for units "seconds since ..." as start of year: - t0 = pandas.to_datetime( tref ).to_pydatetime() + t0 = pandas.to_datetime(tref).to_pydatetime() # create variable: da = xarray.DataArray(values, dims=vdims, coords={"pixel": pixel}, attrs=oda.attrs) @@ -2885,7 +2885,7 @@ class CSO_S5p_Convert(utopya.UtopyaRc): # endif # output dir: - cso_file.CheckDir( output_filename, dmode=dmode ) + cso_file.CheckDir(output_filename, dmode=dmode) # split filename at extension: fname, ext = os.path.splitext(output_filename) diff --git a/src/cso/scripts/cli.py b/src/cso/scripts/cli.py index 27e5c1323583a596c097cabc655d625b6d4d445f..1b5ddb768a5a3d13f746178f3b357d904546d45b 100644 --- a/src/cso/scripts/cli.py +++ b/src/cso/scripts/cli.py @@ -32,6 +32,7 @@ def callback( ): """🛰️ CAMS Satellite Operator (CSO) Command Line Interface""" + @main.command() def run(rc_file: str = typer.Argument(..., help="Provide .rc file")): """Run cso based on settings provided in .rc file (e.g., cso run config/tutorial/tutorial.rc)""" diff --git a/src/utopya/__init__.py b/src/utopya/__init__.py index bfdc256a01ed5cd5abc6ae4c23babb0badc282d6..d09e11aba07bb0524d41458feecd951a9aeb6d51 100644 --- a/src/utopya/__init__.py +++ b/src/utopya/__init__.py @@ -67,21 +67,15 @@ Utopya modules Actual implementations can be found in submodules: -.. The following are names of '.rst' files in the 'doc/sources' directory ; - this ensures that each sub-module is given a seperate page in the documentation. - -.. toctree:: - :maxdepth: 1 - - pymod-utopya_base - pymod-utopya_rc - pymod-utopya_jobscript - pymod-utopya_jobtree - pymod-utopya_runscript - pymod-utopya_tools - pymod-utopya_build - pymod-utopya_post - pymod-utopya_index +* :py:mod:`utopya.utopya_base` +* :py:mod:`utopya.utopya_rc` +* :py:mod:`utopya.utopya_jobscript` +* :py:mod:`utopya.utopya_jobtree` +* :py:mod:`utopya.utopya_runscript` +* :py:mod:`utopya.utopya_tools` +* :py:mod:`utopya.utopya_build` +* :py:mod:`utopya.utopya_post` +* :py:mod:`utopya.utopya_index` .. Label, use :ref:`text