nansencenter / nansat

Scientist friendly Python toolbox for processing 2D satellite Earth observation data.
http://nansat.readthedocs.io
GNU General Public License v3.0
182 stars 66 forks source link

Docstring examples in Exporter.export2thredds are misleading #414

Closed mortenwh closed 5 years ago

mortenwh commented 5 years ago

Examples:

# create THREDDS formatted netcdf file with all bands and time variable
>>> n.export2thredds(filename)

# export only the first band and add global metadata
>>> n.export2thredds(filename, ['L_469'], {'description': 'example'})

But:

In [14]: n.export2thredds('test.nc')                                                                                             
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-14-b7ff63afacc7> in <module>
----> 1 n.export2thredds('test.nc')

TypeError: export2thredds() missing 1 required positional argument: 'bands'

And:

In [15]: n.export2thredds('test.nc', ['sigma0_VV'])                                                                              
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-15-0a7029f3fb05> in <module>
----> 1 n.export2thredds('test.nc', ['sigma0_VV'])

~/Miniconda3-4.6.14-Linux-x86_64/envs/py3openwind/lib/python3.6/site-packages/nansat/exporter.py in export2thredds(self, filename, bands, metadata, mask_name, rm_metadata, time, created)
    184         """
    185         if not isinstance(bands, dict):
--> 186             raise ValueError('<bands> must be dict!')
    187         if metadata is None:
    188             metadata = {}

ValueError: <bands> must be dict!