rbardaji / mooda

Module for Ocean Observatory Data Analysis - Python package
MIT License
18 stars 3 forks source link

WaterFrame.copy() does not work #3

Closed ninahoareau closed 5 years ago

ninahoareau commented 5 years ago

Describe the bug WaterFrame.copy() method does not work in Ubuntu OS:

Expected behavior I need to copy the data of the "WaterFrame#1" to another "WaterFrame#2" to be able to modify it without loosing the original data present in "WaterFrame#1".

1. Code:

'# ... Load files ...'
'# From Sea and Sun'
wf_sas = SeaAndSun.from_tob_to_waterframe(PATH_SAS)
print("SAS INFO")
print(wf_sas)
'# From Sea Bird'
wf_sbe = SeaBird.from_cnv_to_waterframe(PATH_SBE)
print("SBE INFO")
print(wf_sbe)
'# Cut Waterframes SBE in waterframe up and Down'
wf_sbe_up = wf_sbe.copy()

2. See error:

Traceback (most recent call last):
  File "/home/nina/Escritorio/ejemplo/pudem_ctd.py", line 54, in <module>
    wf_sbe_up = wf_sbe.copy()
  File "/home/nina/.conda/envs/python_ctds/lib/python3.7/site-packages/mooda/waterframe.py", line 1611, in copy
    c = copy.deepcopy(self)
  File "/home/nina/.conda/envs/python_ctds/lib/python3.7/copy.py", line 159, in deepcopy
    copier = getattr(x, "__deepcopy__", None)
  File "/home/nina/.conda/envs/python_ctds/lib/python3.7/site-packages/mooda/waterframe.py", line 1814, in __getattr__
    value = self.metadata[key]
KeyError: '__deepcopy__' 

Computer Info:

rbardaji commented 5 years ago

Hi Nina,

I assume you are using mooda v0.5.0. I think I have fixed the bug in mooda v0.5.1. I've just published it.

Can you retry your code (upgrading to mooda v0.5.1) and tell me if you still have problems?

ninahoareau commented 5 years ago

Hello Raul,

I have upgrade to mooda v0.5.1. I still have a problem. Here the message of error: "Traceback (most recent call last): File "/home/nina/Escritorio/ejemplo/pudem_ctd.py", line 54, in wf_sbe_up = wf_sbe.copy() File "/home/nina/.conda/envs/python_ctds/lib/python3.7/site-packages/mooda/waterframe.py", line 1611, in copy c = copy.deepcopy(self) File "/home/nina/.conda/envs/python_ctds/lib/python3.7/copy.py", line 159, in deepcopy copier = getattr(x, "deepcopy", None) File "/home/nina/.conda/envs/python_ctds/lib/python3.7/site-packages/mooda/waterframe.py", line 1814, in getattr value = self.metadata[key] KeyError: 'deepcopy'"

ninahoareau commented 5 years ago

Hi Raul, Now it works! I haven't upgrade mooda in the correct envs. Thank you, Nina