socolofs / tamoc

Texas A&M Oilspill Calculator
MIT License
34 stars 13 forks source link

Problem with OilLibrary #15

Open lindbergh153 opened 2 years ago

lindbergh153 commented 2 years ago

Hello developers, sorry to bother you. I tried to input the oil substance by using the OilLibrary package and failed. The error message is attached as follows.

 -->Loading NOAA Oil Library Oil:  AD00709
 -->Record name:  MALONGO

Traceback (most recent call last): File "D:/PyOilSpill/test.py", line 35, in num_oil_elements, water, current) File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\blowout.py", line 300, in init self._update() File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\blowout.py", line 321, in _update self.q_type) File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 77, in get_oil substance File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 578, in load_adios_oil vapor_pressure_5C = gnome_oil.vapor_pressure(278.15) # Pa TypeError: unhashable type: 'OilProps'

Process finished with exit code 1

socolofs commented 2 years ago

When I run the command to import this oil, I do not get this error. For example:

from tamoc import dbm_utilities as dbm_utils oil = dbm_utils.get_oil('AD00709', 20000., 2000.)

works fine. Did you use similar syntax? If you are using blowout.Blowout object, it should follow this syntax. If you continue getting an error, it may have to do with your ADIOS installation. Do all of the tests pass for Adios?

Thanks, Scott


Scott A. Socolofsky, A.P. and Florence Wiley Professor II, Zachry Department of Civil and Environmental Engineering Department of Oceanography Department of Ocean Engineering Texas A&M University (979) 845-4517

http://ceprofs.civil.tamu.edu/ssocolofsky

On Nov 6, 2021, at 8:09 PM, lindbergh153 @.**@.>> wrote:

This Message Is From an External Sender This message came from outside your organization.

Hello developers, sorry to bother you. I tried to input the oil substance by using the OilLibrary package and failed. The error message is attached as follows.

-->Loading NOAA Oil Library Oil: AD00709 -->Record name: MALONGO

Traceback (most recent call last): File "D:/PyOilSpill/test.py", line 35, in num_oil_elements, water, current) File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\blowout.py", line 300, in init self._update() File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\blowout.py", line 321, in _update self.q_type) File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 77, in get_oil substance File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 578, in load_adios_oil vapor_pressure_5C = gnome_oil.vapor_pressure(278.15) # Pa TypeError: unhashable type: 'OilProps'

Process finished with exit code 1

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/socolofs/tamoc/issues/15__;!!KwNVnqRv!WIMMWvuFq_dp1jvMeel8eSavOcglblOpbxoTwnQr8I0bOcmkwR-qPk7j8IoU8RAP$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AA6XESFD3MEGYMQQV5EDXKLUKXNW5ANCNFSM5HQGXIKA__;!!KwNVnqRv!WIMMWvuFq_dp1jvMeel8eSavOcglblOpbxoTwnQr8I0bOcmkwR-qPk7j8F_Sc-vR$. Triage notifications on the go with GitHub Mobile for iOShttps://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!KwNVnqRv!WIMMWvuFq_dp1jvMeel8eSavOcglblOpbxoTwnQr8I0bOcmkwR-qPk7j8EA3fAR4$ or Androidhttps://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign*3Dnotification-email*26utm_medium*3Demail*26utm_source*3Dgithub__;JSUlJSU!!KwNVnqRv!WIMMWvuFq_dp1jvMeel8eSavOcglblOpbxoTwnQr8I0bOcmkwR-qPk7j8AI6nYhp$.

lindbergh153 commented 2 years ago

Thanks for your reply. I ran the code recommended and the error information is attached below. I guess something wrong with the installation.

from tamoc import dbm_utilities as dbm_utils oil = dbm_utils.get_oil('AD00709', 20000., 2000.)

"D:\Program Files\MiniANACONDA\envs\py376\python.exe" D:/PyOilSpill/test.py -->Loading NOAA Oil Library Oil: AD00709 -->Record name: MALONGO Traceback (most recent call last): File "D:/PyOilSpill/test.py", line 5, in oil = dbm_utils.get_oil('AD00709', 20000., 2000.) File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 77, in get_oil substance File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 578, in load_adios_oil vapor_pressure_5C = gnome_oil.vapor_pressure(278.15) # Pa TypeError: unhashable type: 'OilProps'

ChrisBarker-NOAA commented 2 years ago

Guessing here, but I think the specific issue is that the vapor_pressure method uses an lru_cache.

and the lru_cache requires that the parameters be "hashable", which and oil_props object is not.

However, this has indeed worked in the past, so I think the issue here is that the lru_cache syem is different in some wy depending on Python version, etc.

OilLibrary is best tested with Python 3.8 (and py2.7, bu that's dead now) -- so if TAMOC is py38 compatible, I'd go with that verson and see if you can get it to work.

If not -post an issue on the OilLibary projects as we'll see what we can do:

https://github.com/NOAA-ORR-ERD/OilLibrary

ChrisBarker-NOAA commented 2 years ago

NOTE: I looked yesterday, and realized I hadn't pushed the latest version to gitHub. I've now done that, so please get the latest OilLibrary code and try again.

lindbergh153 commented 2 years ago

I updated the package and the same issue occurred as follows. The python version I used is 3.76.

from tamoc import dbm_utilities as dbm_utils oil = dbm_utils.get_oil('AD00709', 20000., 2000.)

 -->Loading NOAA Oil Library Oil:  AD00709
 -->Record name:  MALONGO

Traceback (most recent call last): File "", line 1, in File "D:\Program Files\PyCharm Community Edition 2020.3.2\plugins\python-ce\helpers\pydev_pydev_bundle\pydev_umd.py", line 198, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "D:\Program Files\PyCharm Community Edition 2020.3.2\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "D:/PyOilSpill/3D_trajectory/new case.py", line 6, in oil = dbm_utils.get_oil('AD00709', 20000., 2000.) File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 77, in get_oil substance File "D:\Program Files\MiniANACONDA\envs\py376\lib\site-packages\tamoc\dbm_utilities.py", line 578, in load_adios_oil vapor_pressure_5C = gnome_oil.vapor_pressure(278.15) # Pa TypeError: unhashable type: 'OilProps'

ChrisBarker-NOAA commented 2 years ago

Try Python 3.8 -- that may be the issue.