caom2utils


Namecaom2utils JSON
Version 1.7.2 PyPI version JSON
download
home_pagehttps://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2
SummaryCAOM-2.4 utils
upload_time2025-02-11 20:26:12
maintainerNone
docs_urlNone
authorCanadian Astronomy Data Centre
requires_python<4,>=3.8
licenseAGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            caom2utils
==========

.. image:: https://img.shields.io/pypi/v/caom2utils.svg   
    :target: https://pypi.python.org/pypi/caom2utils

Utilities to facililate working with the CAOM2 model.

Observation Validation
----------------------

Validates a CAOM2 element (Observation, Plane, Artifact, Part or Chunk) with respect to the attributes of the element and possibly all its sub-elements. Example of validations: attribute values, spherical geometry of planes, WCS of chuncks, etc.

.. code:: python

    import sys
    from caom2 import SimpleObservation
    import caom2utils

    obs = SimpleObservation('collection', 'observationID')

    # change and update obs

    try:
        caom2utils.validate(obs)
    except Exception:
        print('My exception is not valid')


Observation Generation
======================

There are two command-line applications that will generate a CAOM2 Observation in this package. fits2caom2 assumes legacy operations, and should be a not-quite replacement for the Java application. caom2gen provides a bit different invocation mechanism, relying on blueprints for configuration information, and specifies the cardinality of the Observation/Plane/Artifact combinations at the command line.


fits2caom2
----------

.. code-block:: console

    usage: fits2caom2 [-h] [--cert CERT | -n | --netrc-file NETRC_FILE | -u USER]
                      [--host HOST] [--resource-id RESOURCE_ID] [-d | -q | -v]
                      [-V] [--dumpconfig] [--no_validate]
                      [-o OUT_OBS_XML]
                      (-i IN_OBS_XML | --observation collection observationID)
                      [--local LOCAL [LOCAL ...]] [--keep] [--test]
                      [--productID PRODUCTID] [--config CONFIG]
                      [--default DEFAULT] [--override OVERRIDE]
                      fileURI [fileURI ...]

    Augments an observation with information in one or more fits files.

    positional arguments:
      fileURI                                 URI of a fits file

    optional arguments:
      --cert CERT                             location of your X509 certificate to use for
                                              authentication (unencrypted, in PEM format)
      --config CONFIG                         optional CAOM2 utype to keyword config file to merge
                                              with the internal configuration
      -d, --debug                             debug messages
      --default DEFAULT                       file with default values for keywords
      --dumpconfig                            output the utype to keyword mapping to the console
      -h, --help                              show this help message and exit
      --host HOST                             base hostname for services - used mainly for testing
                                              (default: www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca)
      -i, --in IN_OBS_XML                     input of observation to be augmented in XML
      --keep                                  keep the locally stored files after ingestion
      --local LOCAL [ LOCAL ...]
                                              list of files in local filesystem (same order as uri)
      -n                                      use .netrc in $HOME for authentication
      --netrc-file NETRC_FILE                 
                                              netrc file to use for authentication
      --no_validate                           by default, the application will validate the WCS
                                              information for an observation. Specifying this flag
                                              skips that step.
      --observation collection observationID  
                                              observation in a collection
      -o, --out OUT_OBS_XML                   output of augmented observation in XML
      --override OVERRIDE                     file with override values for keywords
      --productID PRODUCTID                   product ID of the plane in the observation
      -q, --quiet                             run quietly
      --resource-id RESOURCE_ID               resource identifier (default
                                              ivo://cadc.nrc.ca/fits2caom2)
      --test                                  test mode, do not persist to database
      -u, --user USER                         name of user to authenticate. Note: application
                                              prompts for the corresponding password!
      -v, --verbose                           verbose messages
      -V, --version                           show program's version number and exit


caom2gen
--------

.. code-block:: console

    usage: caom2gen [-h] [--cert CERT | -n | --netrc-file NETRC_FILE | -u USER] [--host HOST] 
                [--resource-id RESOURCE_ID] [-d | -q | -v] [-V]
                [--dumpconfig] [--not_connected] [--no_validate] [-o OUT_OBS_XML] [--caom_namespace CAOM_NAMESPACE]
                (-i IN_OBS_XML | --observation collection observationID) [--local LOCAL [LOCAL ...]]
                [--external_url EXTERNAL_URL [EXTERNAL_URL ...]] [--module MODULE] [--plugin PLUGIN] 
                [--lineage LINEAGE [LINEAGE ...]]
                [--use_blueprint_parser USE_BLUEPRINT_PARSER [USE_BLUEPRINT_PARSER ...]] --blueprint BLUEPRINT [BLUEPRINT ...]

    Augments an observation with information in one or more fits files.

    optional arguments:
       --blueprint BLUEPRINT [BLUEPRINT ...]  list of files with blueprints for CAOM2 
                                              construction, in serialized format. If 
                                              the list is of length 1, the same 
                                              blueprint will be applied to all lineage 
                                              entries. Otherwise, there must be a 
                                              blueprint file per lineage entry.
       --caom_namespace CAOM_NAMESPACE        if this parameter is specified, over-ride 
                                              the default CAOM2 version when writing 
                                              XML. The default is the latest version of 
                                              CAOM2.3.
       --cert CERT                            location of your X509 certificate to use 
                                              for authentication (unencrypted, in PEM 
                                              format)
       -d, --debug                            debug messages
       --dumpconfig                           output the utype to keyword mapping to 
                                              the console
       --external_url EXTERNAL_URL [EXTERNAL_URL ...]
                                              service endpoint(s) that return(s) a 
                                              string that can be made into FITS 
                                              headers. Cardinality should be consistent 
                                              with lineage.
       -h, --help                             show this help message and exit
       --host HOST                            base hostname for services - used mainly 
                                              for testing (default: 
                                              www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca)
       -i, --in IN_OBS_XML                    input of observation to be augmented in XML
       --lineage LINEAGE [LINEAGE ...]        productID/artifactURI. List of plane/artifact 
                                              identifiers that will be created for the 
                                              identified observation.
       --local LOCAL [LOCAL ...]              list of files in local filesystem (same 
                                              order as uri)
       --module MODULE                        if the blueprint contains function calls, 
                                              call importlib.import_module for the named 
                                              module. Provide a fully qualified name. 
                                              Parameter choices are the artifact URI (uri) 
                                              or a list of astropy Header instances 
                                              (header). This will allow the update of a 
                                              single blueprint entry with a single call.
       -n                                     use .netrc in $HOME for authentication
       --netrc-file NETRC_FILE                netrc file to use for authentication
       --no_validate                          by default, the application will validate 
                                              the WCS information for an observation. 
                                              Specifying this flag skips that step.
       --not_connected                        if set, there is no internet connection, 
       so skip service invocations.
       --observation collection observationID observation in a collection
       -o, --out OUT_OBS_XML                  output of augmented observation in XML
       --plugin PLUGIN                        if this parameter is specified, call 
                                              importlib.import_module for the named 
                                              module. Then execute the method "update", 
                                              with the signature (Observation, **kwargs). 
                                              This will allow for the update of multiple 
                                              observation data members with one call.
       -q, --quiet                            run quietly
       --resource-id RESOURCE_ID              resource identifier (default 
                                              ivo://cadc.nrc.ca/fits2caom2)
       --use_blueprint_parser USE_BLUEPRINT_PARSER [USE_BLUEPRINT_PARSER ...]
                                              productID/artifactURI. List of lineage 
                                              entries that will be processed with a 
                                              BlueprintParser. Good for files with no
                                              metadata in the content.
       -u, --user USER                        name of user to authenticate. Note: 
                                              application prompts for the corresponding 
                                              password!
       -v, --verbose                          verbose messages
       -V, --version                          show program's version number and exit

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2",
    "name": "caom2utils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Canadian Astronomy Data Centre",
    "author_email": "cadc@nrc-cnrc.gc.ca",
    "download_url": "https://files.pythonhosted.org/packages/90/99/e69eb7f4fd4892cd860a5ee3f74ba8f1b8628b82bc0d845c90b7ba209412/caom2utils-1.7.2.tar.gz",
    "platform": null,
    "description": "caom2utils\n==========\n\n.. image:: https://img.shields.io/pypi/v/caom2utils.svg   \n    :target: https://pypi.python.org/pypi/caom2utils\n\nUtilities to facililate working with the CAOM2 model.\n\nObservation Validation\n----------------------\n\nValidates a CAOM2 element (Observation, Plane, Artifact, Part or Chunk) with respect to the attributes of the element and possibly all its sub-elements. Example of validations: attribute values, spherical geometry of planes, WCS of chuncks, etc.\n\n.. code:: python\n\n    import sys\n    from caom2 import SimpleObservation\n    import caom2utils\n\n    obs = SimpleObservation('collection', 'observationID')\n\n    # change and update obs\n\n    try:\n        caom2utils.validate(obs)\n    except Exception:\n        print('My exception is not valid')\n\n\nObservation Generation\n======================\n\nThere are two command-line applications that will generate a CAOM2 Observation in this package. fits2caom2 assumes legacy operations, and should be a not-quite replacement for the Java application. caom2gen provides a bit different invocation mechanism, relying on blueprints for configuration information, and specifies the cardinality of the Observation/Plane/Artifact combinations at the command line.\n\n\nfits2caom2\n----------\n\n.. code-block:: console\n\n    usage: fits2caom2 [-h] [--cert CERT | -n | --netrc-file NETRC_FILE | -u USER]\n                      [--host HOST] [--resource-id RESOURCE_ID] [-d | -q | -v]\n                      [-V] [--dumpconfig] [--no_validate]\n                      [-o OUT_OBS_XML]\n                      (-i IN_OBS_XML | --observation collection observationID)\n                      [--local LOCAL [LOCAL ...]] [--keep] [--test]\n                      [--productID PRODUCTID] [--config CONFIG]\n                      [--default DEFAULT] [--override OVERRIDE]\n                      fileURI [fileURI ...]\n\n    Augments an observation with information in one or more fits files.\n\n    positional arguments:\n      fileURI                                 URI of a fits file\n\n    optional arguments:\n      --cert CERT                             location of your X509 certificate to use for\n                                              authentication (unencrypted, in PEM format)\n      --config CONFIG                         optional CAOM2 utype to keyword config file to merge\n                                              with the internal configuration\n      -d, --debug                             debug messages\n      --default DEFAULT                       file with default values for keywords\n      --dumpconfig                            output the utype to keyword mapping to the console\n      -h, --help                              show this help message and exit\n      --host HOST                             base hostname for services - used mainly for testing\n                                              (default: www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca)\n      -i, --in IN_OBS_XML                     input of observation to be augmented in XML\n      --keep                                  keep the locally stored files after ingestion\n      --local LOCAL [ LOCAL ...]\n                                              list of files in local filesystem (same order as uri)\n      -n                                      use .netrc in $HOME for authentication\n      --netrc-file NETRC_FILE                 \n                                              netrc file to use for authentication\n      --no_validate                           by default, the application will validate the WCS\n                                              information for an observation. Specifying this flag\n                                              skips that step.\n      --observation collection observationID  \n                                              observation in a collection\n      -o, --out OUT_OBS_XML                   output of augmented observation in XML\n      --override OVERRIDE                     file with override values for keywords\n      --productID PRODUCTID                   product ID of the plane in the observation\n      -q, --quiet                             run quietly\n      --resource-id RESOURCE_ID               resource identifier (default\n                                              ivo://cadc.nrc.ca/fits2caom2)\n      --test                                  test mode, do not persist to database\n      -u, --user USER                         name of user to authenticate. Note: application\n                                              prompts for the corresponding password!\n      -v, --verbose                           verbose messages\n      -V, --version                           show program's version number and exit\n\n\ncaom2gen\n--------\n\n.. code-block:: console\n\n    usage: caom2gen [-h] [--cert CERT | -n | --netrc-file NETRC_FILE | -u USER] [--host HOST] \n                [--resource-id RESOURCE_ID] [-d | -q | -v] [-V]\n                [--dumpconfig] [--not_connected] [--no_validate] [-o OUT_OBS_XML] [--caom_namespace CAOM_NAMESPACE]\n                (-i IN_OBS_XML | --observation collection observationID) [--local LOCAL [LOCAL ...]]\n                [--external_url EXTERNAL_URL [EXTERNAL_URL ...]] [--module MODULE] [--plugin PLUGIN] \n                [--lineage LINEAGE [LINEAGE ...]]\n                [--use_blueprint_parser USE_BLUEPRINT_PARSER [USE_BLUEPRINT_PARSER ...]] --blueprint BLUEPRINT [BLUEPRINT ...]\n\n    Augments an observation with information in one or more fits files.\n\n    optional arguments:\n       --blueprint BLUEPRINT [BLUEPRINT ...]  list of files with blueprints for CAOM2 \n                                              construction, in serialized format. If \n                                              the list is of length 1, the same \n                                              blueprint will be applied to all lineage \n                                              entries. Otherwise, there must be a \n                                              blueprint file per lineage entry.\n       --caom_namespace CAOM_NAMESPACE        if this parameter is specified, over-ride \n                                              the default CAOM2 version when writing \n                                              XML. The default is the latest version of \n                                              CAOM2.3.\n       --cert CERT                            location of your X509 certificate to use \n                                              for authentication (unencrypted, in PEM \n                                              format)\n       -d, --debug                            debug messages\n       --dumpconfig                           output the utype to keyword mapping to \n                                              the console\n       --external_url EXTERNAL_URL [EXTERNAL_URL ...]\n                                              service endpoint(s) that return(s) a \n                                              string that can be made into FITS \n                                              headers. Cardinality should be consistent \n                                              with lineage.\n       -h, --help                             show this help message and exit\n       --host HOST                            base hostname for services - used mainly \n                                              for testing (default: \n                                              www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca)\n       -i, --in IN_OBS_XML                    input of observation to be augmented in XML\n       --lineage LINEAGE [LINEAGE ...]        productID/artifactURI. List of plane/artifact \n                                              identifiers that will be created for the \n                                              identified observation.\n       --local LOCAL [LOCAL ...]              list of files in local filesystem (same \n                                              order as uri)\n       --module MODULE                        if the blueprint contains function calls, \n                                              call importlib.import_module for the named \n                                              module. Provide a fully qualified name. \n                                              Parameter choices are the artifact URI (uri) \n                                              or a list of astropy Header instances \n                                              (header). This will allow the update of a \n                                              single blueprint entry with a single call.\n       -n                                     use .netrc in $HOME for authentication\n       --netrc-file NETRC_FILE                netrc file to use for authentication\n       --no_validate                          by default, the application will validate \n                                              the WCS information for an observation. \n                                              Specifying this flag skips that step.\n       --not_connected                        if set, there is no internet connection, \n       so skip service invocations.\n       --observation collection observationID observation in a collection\n       -o, --out OUT_OBS_XML                  output of augmented observation in XML\n       --plugin PLUGIN                        if this parameter is specified, call \n                                              importlib.import_module for the named \n                                              module. Then execute the method \"update\", \n                                              with the signature (Observation, **kwargs). \n                                              This will allow for the update of multiple \n                                              observation data members with one call.\n       -q, --quiet                            run quietly\n       --resource-id RESOURCE_ID              resource identifier (default \n                                              ivo://cadc.nrc.ca/fits2caom2)\n       --use_blueprint_parser USE_BLUEPRINT_PARSER [USE_BLUEPRINT_PARSER ...]\n                                              productID/artifactURI. List of lineage \n                                              entries that will be processed with a \n                                              BlueprintParser. Good for files with no\n                                              metadata in the content.\n       -u, --user USER                        name of user to authenticate. Note: \n                                              application prompts for the corresponding \n                                              password!\n       -v, --verbose                          verbose messages\n       -V, --version                          show program's version number and exit\n",
    "bugtrack_url": null,
    "license": "AGPLv3",
    "summary": "CAOM-2.4 utils",
    "version": "1.7.2",
    "project_urls": {
        "Homepage": "https://www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca/caom2"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "81ce6cf22b47205c574990bc974e983773206e5836553b67f58e03a543af703c",
                "md5": "7da90c44e49177c067c06444b803d3a6",
                "sha256": "0aadc94fb21b4bbf1c91afa066bc27d8f7ae791ff4c4e29e2ce026ec5a685a8b"
            },
            "downloads": -1,
            "filename": "caom2utils-1.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7da90c44e49177c067c06444b803d3a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.8",
            "size": 217775,
            "upload_time": "2025-02-11T20:26:10",
            "upload_time_iso_8601": "2025-02-11T20:26:10.241142Z",
            "url": "https://files.pythonhosted.org/packages/81/ce/6cf22b47205c574990bc974e983773206e5836553b67f58e03a543af703c/caom2utils-1.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9099e69eb7f4fd4892cd860a5ee3f74ba8f1b8628b82bc0d845c90b7ba209412",
                "md5": "ae059d9258c773e304050f6fc980acd1",
                "sha256": "36cdc1f39727230da6e44478d61a9a6f5928ee6930a5b9dd2495705d992b0fc1"
            },
            "downloads": -1,
            "filename": "caom2utils-1.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ae059d9258c773e304050f6fc980acd1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.8",
            "size": 185867,
            "upload_time": "2025-02-11T20:26:12",
            "upload_time_iso_8601": "2025-02-11T20:26:12.057549Z",
            "url": "https://files.pythonhosted.org/packages/90/99/e69eb7f4fd4892cd860a5ee3f74ba8f1b8628b82bc0d845c90b7ba209412/caom2utils-1.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-11 20:26:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "caom2utils"
}
        
Elapsed time: 1.15549s