ArgoCanada / medsrtqc

An experimental container for Argo Canada realtime quality control code
https://argocanada.github.io/medsrtqc/
MIT License
0 stars 1 forks source link

Remove (?) restriction on updating Trace.value, adjusted, etc #12

Closed cgrdn closed 2 years ago

cgrdn commented 2 years ago

The adjusted field will certainly need to be updated for chlorophyll, and depending on if conversion happens in this package or in the decoding process, the value field may also need to be updated. Waiting to hear from Anh on the latter.

Perhaps the best thing would be to downgrade the errors to warnings? Pasting the error traceback that prompted this issue below.

ValueError                                Traceback (most recent call last)
c:\Users\GordonC\Documents\projects\medsrtqc\batman_test.py in <module>
     [89](file:///c%3A/Users/GordonC/Documents/projects/medsrtqc/batman_test.py?line=88) # try to fun chla test
     [90](file:///c%3A/Users/GordonC/Documents/projects/medsrtqc/batman_test.py?line=89) test = ChlaTest()
---> [91](file:///c%3A/Users/GordonC/Documents/projects/medsrtqc/batman_test.py?line=90) test.run(prof)
     [92](file:///c%3A/Users/GordonC/Documents/projects/medsrtqc/batman_test.py?line=91) 
     [93](file:///c%3A/Users/GordonC/Documents/projects/medsrtqc/batman_test.py?line=92) fid.close()

c:\Users\GordonC\Documents\projects\medsrtqc\medsrtqc\qc\operation.py in run(self, profile, previous_profile, context)
    162         
    163         with QCOperationProfileContext(self, profile, previous_profile, context):
--> 164             return self.run_impl()
    165 
    166     def run_impl(self):

c:\Users\GordonC\Documents\projects\medsrtqc\medsrtqc\qc\chla.py in run_impl(self)
    118 
    119         # update the CHLA trace
--> 120         self.update_trace('FLU1', chla)
    121 
    122     def mixed_layer_depth(self):

c:\Users\GordonC\Documents\projects\medsrtqc\medsrtqc\qc\operation.py in update_trace(self, k, trace)
    141     def update_trace(self, k, trace):
    142         """Convenience wrapper for :func:`QCOperationContext.update_trace`"""
--> 143         self.context.update_trace(self.profile, k, trace)
    144 
    145     def log(self, message):

c:\Users\GordonC\Documents\projects\medsrtqc\medsrtqc\qc\operation.py in update_trace(self, profile, k, trace)
     46         """The default method runs ``profile[k] = trace``.
     47         """
---> 48         profile[k] = trace
     49 
     50     def log(self, profile, message):

c:\Users\GordonC\Documents\projects\medsrtqc\medsrtqc\vms\core_impl.py in __setitem__(self, k, v)
     95         # to get lost
     96         if not np.all(v.value == current_value.value):
---> 97             raise ValueError("Can't update Trace.value in a VMSProfile")
     98         if not np.all(v.pres == current_value.pres):
     99             raise ValueError("Can't update Trace.pres in a VMSProfile")

ValueError: Can't update Trace.value in a VMSProfile
cgrdn commented 2 years ago

A comment here: I changed the errors for Trace().adjusted and Trace().adjusted_qc to be warnings. However, as described in #13, they don't make it into the Profile() and therefore into the VMS. I will still leave them as warnings, but will make the message more descriptive (i.e. warn that they will not save to Profile() or VMS file). Once that is complete will close this issue.