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

Problem with OilLibrary #15

Open
lindbergh153 opened this issue Nov 7, 2021 · 6 comments
Open

Problem with OilLibrary #15

lindbergh153 opened this issue Nov 7, 2021 · 6 comments

Comments

@lindbergh153
Copy link

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
Copy link
Owner

socolofs commented Nov 8, 2021 via email

@lindbergh153
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Collaborator

Try Python 3.8 -- that may be the issue.

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

No branches or pull requests

3 participants