Skip to content

Commit

Permalink
changed digest to harchive
Browse files Browse the repository at this point in the history
command name clash on CSC
  • Loading branch information
trmrsh committed Sep 9, 2021
1 parent 8d66fbf commit 93f5bd5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/commands.rst
Expand Up @@ -486,7 +486,7 @@ extension '.hcm' to distinguish them, although they are also FITS-format files.
.. autofunction:: hipercam.scripts.uls

.. [#f1] Several other commands (``aligntool``, ``atanalysis``, ``atbytes``,
``digest``, ``hlogger``, ``hmeta``, ``makefield``, ``makedata``, ``pfolder``,
``harchive``, ``hlogger``, ``hmeta``, ``makefield``, ``makedata``, ``pfolder``,
``redplt``, ``tanalysis``, ``tbytes``) are not documented here
as they are of specialist usage. Information on these is however available via
``pydoc``.
Expand Down
2 changes: 1 addition & 1 deletion docs/globals.rst
Expand Up @@ -19,13 +19,13 @@
.. |cmul| replace:: :func:`cmul <hipercam.scripts.cmul>`
.. |combine| replace:: :func:`combine <hipercam.scripts.combine>`
.. |csub| replace:: :func:`csub <hipercam.scripts.csub>`
.. |digest| replace:: :func:`digest <hipercam.scripts.digest>`
.. |div| replace:: :func:`div <hipercam.scripts.div>`
.. |fits2hcm| replace:: :func:`fits2hcm <hipercam.scripts.fits2hcm>`
.. |flagcloud| replace:: :func:`flagcloud <hipercam.scripts.flagcloud>`
.. |ftargets| replace:: :func:`ftargets <hipercam.scripts.ftargets>`
.. |genred| replace:: :func:`genred <hipercam.scripts.genred>`
.. |grab| replace:: :func:`grab <hipercam.scripts.grab>`
.. |harchive| replace:: :func:`harchive <hipercam.scripts.harchive>`
.. |hfilter| replace:: :func:`hfilter <hipercam.scripts.hfilter>`
.. |hinfo| replace:: :func:`hinfo <hipercam.scripts.hinfo>`
.. |hist| replace:: :func:`hist <hipercam.scripts.hist>`
Expand Down
1 change: 1 addition & 0 deletions hipercam/scripts/__init__.py
Expand Up @@ -16,6 +16,7 @@
from .ftargets import ftargets
from .grab import grab
from .genred import genred
from .harchive import harchive
from .hist import hist
from .hinfo import hinfo
from .hfilter import hfilter
Expand Down
32 changes: 16 additions & 16 deletions hipercam/scripts/digest.py → hipercam/scripts/harchive.py
Expand Up @@ -16,17 +16,17 @@
from hipercam.cline import Cline

__all__ = [
"digest",
"harchive",
]

###########################################################
#
# digest -- ingests hipercam etc data for archival purposes
# harchive -- ingests hipercam etc data for archival purposes
#
###########################################################


def digest(args=None):
def harchive(args=None):
description = """Ingests hipercam/ultra(cam|spec) data from the telescope for
archiving purposes.
Expand All @@ -53,7 +53,7 @@ def digest(args=None):
'-h' to see help. It is not uncommon for there to be more log
entries that there are runs if people pre-populate the log file
but never take the runs. This causes an error that can be skipped
with the '-i' option. 'digest' also now takes a more relaxed approach
with the '-i' option. 'harchive' also now takes a more relaxed approach
to any directories grouped under 'Others' where it will try to carry
out checks but ignore problems where possible because it is common
for other observers not to conform to our standards.
Expand All @@ -66,7 +66,7 @@ def digest(args=None):

username = getpass.getuser()
if username != "phsaap":
print("digest is for archiving HiPERCAM runs and not " "meant for general use")
print("harchive is for archiving HiPERCAM runs and not " "meant for general use")
return

parser = argparse.ArgumentParser(description=description)
Expand Down Expand Up @@ -96,17 +96,17 @@ def digest(args=None):

cwd = os.getcwd()
if os.path.basename(cwd) != "raw_data":
print("** digest must be run in a directory called 'raw_data'")
print("digest aborted", file=sys.stderr)
print("** harchive must be run in a directory called 'raw_data'")
print("harchive aborted", file=sys.stderr)
return

if cwd.find("ultracam") > -1 or cwd.find("ultraspec") > -1:
itype = 'U'
elif cwd.find("hipercam") > -1:
itype = 'H'
else:
print("** digest: failed to find one of hipercam, ultracam or ultraspec in path")
print("digest aborted", file=sys.stderr)
print("** harchive: failed to find one of hipercam, ultracam or ultraspec in path")
print("harchive aborted", file=sys.stderr)
return

# regular expression to match run directory, e.g. 2018-10 [2018, October],
Expand All @@ -133,7 +133,7 @@ def digest(args=None):

if not len(rdirs):
print("\n** Found no run directories", file=sys.stderr)
print("digest aborted", file=sys.stderr)
print("harchive aborted", file=sys.stderr)
return

print("\nChecking run-by-run ...\n")
Expand Down Expand Up @@ -175,7 +175,7 @@ def digest(args=None):
nnew = os.path.basename(ndir).replace('_','-')
if os.path.exists(nnew):
print(f'A directory called {nnew} already exists clashing with {ndir}')
print('digest aborted',file=sys.stderr)
print('harchive aborted',file=sys.stderr)
return

log = os.path.join(ndir, f"{night}_log.dat")
Expand All @@ -196,7 +196,7 @@ def digest(args=None):
lruns = None
print(f"** no log file called {log} found", file=sys.stderr)
if strict:
print("digest aborted", file=sys.stderr)
print("harchive aborted", file=sys.stderr)
return


Expand Down Expand Up @@ -233,7 +233,7 @@ def digest(args=None):
if ignore:
print("ignoring problem and continuing.")
else:
print("digest aborted", file=sys.stderr)
print("harchive aborted", file=sys.stderr)
return


Expand All @@ -257,7 +257,7 @@ def digest(args=None):
f"** no md5sum file called {md5} found", file=sys.stderr
)
if strict:
print("digest aborted", file=sys.stderr)
print("harchive aborted", file=sys.stderr)
return

if strict and set(mruns) != set(runs):
Expand All @@ -267,7 +267,7 @@ def digest(args=None):
file=sys.stderr,
)
print(f"Runs not in common are: {set(runs) ^ set(mruns)}")
print("digest aborted", file=sys.stderr)
print("harchive aborted", file=sys.stderr)
return


Expand Down Expand Up @@ -300,7 +300,7 @@ def digest(args=None):
file=sys.stderr,
)
if strict:
print("digest aborted")
print("harchive aborted")
return

# Now change the data structure into my standard form:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -136,14 +136,14 @@
'cmul=hipercam.scripts.carith:cmul',
'combine=hipercam.scripts.combine:combine',
'csub=hipercam.scripts.carith:csub',
'digest=hipercam.scripts.digest:digest',
'div=hipercam.scripts.arith:div',
'filtid=hipercam.scripts.filtid:filtid',
'fits2hcm=hipercam.scripts.fits2hcm:fits2hcm',
'flagcloud=hipercam.scripts.flagcloud:flagcloud',
'ftargets=hipercam.scripts.ftargets:ftargets',
'genred=hipercam.scripts.genred:genred',
'grab=hipercam.scripts.grab:grab',
'harchive=hipercam.scripts.harchive:harchive',
'hfilter=hipercam.scripts.hfilter:hfilter',
'hinfo=hipercam.scripts.hinfo:hinfo',
'hist=hipercam.scripts.hist:hist',
Expand Down

0 comments on commit 93f5bd5

Please sign in to comment.