Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAOM2.5 (CADC-13449) #186

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

CAOM2.5 (CADC-13449) #186

wants to merge 8 commits into from

Conversation

andamian
Copy link
Contributor

@andamian andamian commented Jan 28, 2025

This commit includes:

@andamian andamian marked this pull request as draft January 28, 2025 00:53
Copy link
Collaborator

@SharonGoliath SharonGoliath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!
Other general comments:

  1. setup.cfg specifies 120 length line width, but none of the changes make use of it.
  2. should the code use f-strings instead of format?
  3. the file encodings can be removed
  4. When going from 2.3 to 2.4, in the Plane class, there was some effort to keep both the energy_bands (2.4) and the em_bands (2.3) version of the metadata in the Plane class. There has been no work of that kind for the 2.4 -> 2.5 transition. Is that on purpose?

eg: Artifact('ad:CFHT/1234567o')
where 'ad:CFHT/1234567o' is a uri that refernce the file...
eg: Artifact('cadc:CFHT/1234567o')
where 'cadc:CFHT/1234567o' is an uri that reference the file...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're doing spelling, "references the file ..."


Arguments: uri of the artifact. eg:
vos://cadc.nrc.ca!vospace/APASS/apass_north/proc/100605/n100605.fz
ad:CFHT/123456p
"""
super(Artifact, self).__init__()
self.uri = uri
try:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the method validate_uri be used here?

for i in value:
if not isinstance(value[i], AbstractCaomEntity):
checksums.append(value[i]._id)
for i in sorted(checksums):
update_checksum(checksum, checksum[i], attribute)
updated &= update_checksum(checksum, checksum[i], attribute)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should &= be |=? Either that, or a comment for why dict values need to be consistently "updated", and set and list values do not?

for i in value:
if not isinstance(value[i], AbstractCaomEntity):
checksums.append(value[i]._id)
for i in sorted(checksums):
update_checksum(checksum, checksum[i], attribute)
updated &= update_checksum(checksum, checksum[i], attribute)
return updated
else:
raise ValueError(
'Cannot transform in bytes: {}({})'.format(value, type(value)))

if b is not None:
checksum.update(b)
if logger.isEnabledFor(logging.DEBUG):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the removal of the hashlib calculation, is the isEnabledFor check still needed?

return False


def to_model_name(attribute):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just like to confirm that id or ID is purposefully now Id, when it's not the first "word" in an attribute.

@@ -852,7 +894,7 @@ def __init__(self, name,
self.last_executed = last_executed

self._keywords = set()
self._inputs = caom_util.TypedSet(PlaneURI, )
self._inputs = caom_util.TypedSet(str, )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypedSet seems like overkill for str

self.assertEqual(binascii.hexlify(
bytearray.fromhex("e30580c1db513487f495fba09f64600e")),
binascii.hexlify(cs_uri.get_bytes()), "Round trip")
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the commented-out code.

@@ -239,31 +240,17 @@ def test_complete_derived(self):
version)

def test_versions(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method does not have any tests for 25 against other docs. Was there a decision made to not keep this cross-version checking going forward for 25?

except ValueError:
exception = True
self.assertTrue(exception, "Missing exception")
#
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete.

import logging

from .plane import CalibrationStatus, Ucd, Polarization

DATA_PKG = 'data'

CAOM22_SCHEMA_FILE = 'CAOM-2.2.xsd'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this definition still required? Correspondingly, there is a file caom2/caom2/data/CAOM-2.2.xsd. Does it need to be kept?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants