ccht-ncsu / Kalpana

Visualization of ADCIRC Model Data in Vector Formats
GNU General Public License v3.0
26 stars 22 forks source link

TypeError: unhashable type: 'MaskedArray' #26

Closed formidablefrank closed 1 year ago

formidablefrank commented 3 years ago

Hi! I could not run Kalpana using the command:

python ./kalpana.py --filetype maxele.63.nc --polytype polygon --viztype kmz --storm DURIAN --lonlatbox '14.078945 13.968730 121.988472 121.869038' --lonlatbuffer 0.0 --subplots no --contourrange '0 10 0.5' --palettename water-level.pal --datumlabel "mean sea level"

Then kalpana had an error (screenshot attached below):

Time step 0
Traceback (most recent call last):
  File "./kalpana.py", line 1197, in <module>
    geoms[time_var[i]] = []
  File "/home/franco/.conda/envs/kalpana/lib/python2.7/collections.py", line 75, in __setitem__
    if key not in self:
TypeError: unhashable type: 'MaskedArray'

I am using python 2.7.18 and conda 4.9.2, with the following pip packages:

attrs==20.3.0
backports.functools-lru-cache==1.6.1
certifi==2020.6.20
cftime==1.3.1
click==7.1.2
click-plugins==1.1.1
cligj==0.7.1
cycler==0.10.0
enum34==1.1.10
Fiona==1.8.18
kiwisolver==1.1.0
matplotlib==2.2.5
munch==2.5.0
netCDF4==1.5.5.1
numpy==1.16.6
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.5
Shapely==1.7.1
simplekml==1.3.5
six==1.15.0
subprocess32==3.5.4

Is there any specific software versions that I should use? Thank you.

Screenshot

carucker commented 3 years ago

Sometimes Kalpana can have issues with the time variable within maxele.63.nc. Because we are not typically interested in the time component of maxele.63.nc, one easy fix to this issue would be to temporarily comment out all of the time-dependent lines within Kalpana. It might be useful for us to add "if" statements to Kalpana in the future, getting rid of these lines when we don't need them.

Another way to fix this would be to add a time component to your maxele.63.nc file. It is likely that you are having this issue because no time component exists. Here is one example of a way I had previously done this in Python:

try: ncfile.close() except: pass

ncfile=netCDF4.Dataset(r"C:\Users...\maxele.63.nc ",mode="w",format="NETCDF4_CLASSIC")

time_dim=ncfile.createDimension('time',None)

time=ncfile.createVariable('time',np.double,('time',)) time.long_name="model time" time.standard_name="time" time.units="seconds since 2019-08-01 00:00:00" time.base_date="2019-08-01 00:00:00"

ncfile.close()

Carter A. Rucker, EI Coastal Engineer - Water Resources Section Wilmington District U.S. Army Corps of Engineers 69 Darlington Ave. Wilmington, NC 28403 O: 910-251-4799 C: 919-605-0221

On Tue, Jan 26, 2021 at 7:08 AM J Franco Ray notifications@github.com wrote:

Hi! I could not run Kalpana using the command:

python ./kalpana.py --filetype maxele.63.nc --polytype polygon --viztype kmz --storm DURIAN --lonlatbox '14.078945 13.968730 121.988472 121.869038' --lonlatbuffer 0.0 --subplots no --contourrange '0 10 0.5' --palettename water-level.pal --datumlabel "mean sea level"

Then kalpana had an error (screenshot attached below):

Time step 0 Traceback (most recent call last): File "./kalpana.py", line 1197, in geoms[time_var[i]] = [] File "/home/franco/.conda/envs/kalpana/lib/python2.7/collections.py", line 75, in setitem if key not in self: TypeError: unhashable type: 'MaskedArray'

I am using python 2.7.18 and conda 4.9.2, with the following pip packages:

attrs==20.3.0 backports.functools-lru-cache==1.6.1 certifi==2020.6.20 cftime==1.3.1 click==7.1.2 click-plugins==1.1.1 cligj==0.7.1 cycler==0.10.0 enum34==1.1.10 Fiona==1.8.18 kiwisolver==1.1.0 matplotlib==2.2.5 munch==2.5.0 netCDF4==1.5.5.1 numpy==1.16.6 pyparsing==2.4.7 python-dateutil==2.8.1 pytz==2020.5 Shapely==1.7.1 simplekml==1.3.5 six==1.15.0 subprocess32==3.5.4

Is there any specific software versions that I should use? Thank you.

[image: Screenshot] https://user-images.githubusercontent.com/5762748/105843031-fef06080-5fce-11eb-816b-61f9fd274457.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ccht-ncsu/Kalpana/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEXEA3T2W45GTCCVC3BQZLS32WERANCNFSM4WTLAU4Q .