openearth / oceanwaves-python

Toolbox to handle ocean waves datasets
http://oceanwaves.readthedocs.io
MIT License
64 stars 39 forks source link

Error in .units simplify #17

Closed shalevale closed 7 years ago

shalevale commented 7 years ago

Hi, I am trying to ejecute the reproducible example of the notebook:


import re import seaborn as sns import oceanwaves import xarray as xr from datetime import datetime

measurement times

time = [datetime(2013,12,1), datetime(2014,12,2)]

measurement locations

location = [(0,0),(0,1),(1,1),(.5,.5)]

initialize OceanWaves object

ow = oceanwaves.OceanWaves(time=time, time_var='datetime', location=location, crs='epsg:28992', energy_units='m', energy_var='waveheight') # note we are defining wave heights here!


But I get an error:


NameError Traceback (most recent call last)

in () 3 location=location, 4 energy_units='m', ----> 5 energy_var='waveheight') C:\Users\USUARIO\Anaconda3\lib\site-packages\oceanwaves-0.0-py3.5.egg\oceanwaves\oceanwaves.py in __init__(self, *args, **kwargs) 93 self.merge(obj, inplace=True) 94 else: ---> 95 self.initialize(*args, **kwargs) 96 97 C:\Users\USUARIO\Anaconda3\lib\site-packages\oceanwaves-0.0-py3.5.egg\oceanwaves\oceanwaves.py in initialize(self, time, location, frequency, direction, energy, spreading, time_units, location_units, frequency_units, direction_units, energy_units, time_var, location_var, frequency_var, direction_var, energy_var, spreading_var, frequency_convention, direction_convention, spreading_convention, attrs, crs, **kwargs) 177 178 # simplify units --> 179 time_units = simplify(time_units) 180 location_units = simplify(location_units) 181 frequency_units = simplify(frequency_units) C:\Users\USUARIO\Anaconda3\lib\site-packages\oceanwaves-0.0-py3.5.egg\oceanwaves\units.py in simplify(units) 49 50 # only continue in case of string or unicode input ---> 51 if type(units) not in [str, unicode]: 52 return units 53 NameError: name 'unicode' is not defined ------------------------------------------------------------------------------------------------------- @hoonhout May do you know why it is happening? Thank you!
hoonhout commented 7 years ago

I guess you are running Python 3. The library is not yet Python 3 compatible. We intend to fix this soon. Any help is appreciated.

hoonhout commented 7 years ago

Hi @shalevale, I did a quick run through the code. The examples should now run fine in Python 3 as well. Can you test if your problem has been solved? Bas

shalevale commented 7 years ago

Hi! Thank you so much, I am trying to download the package in pip, but I get an error.

When I got it, I will check if all it is ok in python 3,

see you!

shalevale commented 7 years ago

Hiii @hoonhout I test the notebook example now, and works great in python 3.6!!!

Thank you so much for you rapidly conttribution!