Open
Description
#741 assumes that units has a strip()
method, which isn't true if there aren't any
Convoluted example, don't have time to really boil down right now:
import spacepy.datamodel
#https://rbsp-ect.newmexicoconsortium.org/data_pub/rbspa/ECT/level2/rbspa_ect-elec-L2_20140115_v2.1.0.cdf
data = spacepy.datamodel.fromCDF('./rbspa_ect-elec-L2_20140115_v2.1.0.cdf')
df = data.toDataFrame('Position')
spacepy.datamodel.SpaceData.fromDataFrame(df).plot()
Error message/Traceback:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[11], line 1
----> 1 spacepy.datamodel.SpaceData.fromDataFrame(df).plot()
File ~/.local//lib//python3.12/site-packages/spacepy/datamodel.py:471, in ISTPContainer.plot(self, vnames, fig)
469 ax = fig.add_subplot(n_plots, 1, i + 1)
470 if self[k].plot_as_line():
--> 471 self.lineplot(k, target=ax)
472 h, l = ax.get_legend_handles_labels()
473 if l:
File ~/.local//lib//python3.12/site-packages/spacepy/datamodel.py:368, in ISTPContainer.lineplot(self, vname, target)
366 ylabel = v.attrs.get('LABLAXIS', '')
367 u = v.units(fmt='latex')
--> 368 if u.strip():
369 ylabel = '{}{}(${}$)'.format(ylabel, ' ' if ylabel else '', u)
370 if ylabel:
AttributeError: 'NoneType' object has no attribute 'strip'
OS, Python version, and dependency version information:
Linux-6.8.0-48-generic-x86_64-with-glibc2.39
sys.version_info(major=3, minor=12, micro=3, releaselevel='final', serial=0)
numpy=1.26.4
scipy=1.11.4
matplotlib=3.6.3
Version of SpacePy
0.7.0, either from source or testing the release wheel....
Metadata
Assignees
Labels
No labels