ARPA-SIMC / dballe

Fast on-disk database for meteorological observed and forecast data.
Other
19 stars 6 forks source link

wrong examples in documentation #204

Closed pat1 closed 4 years ago

pat1 commented 4 years ago

https://arpa-simc.github.io/dballe/python/dballe_messages.html

class dballe.Message

    print("{m.report},{m.coords},{m.ident},{m.datetime},{m.type}".format(m=msg))
AttributeError: 'tuple' object has no attribute 'report'

suggested example:

importer = dballe.Importer("BUFR")
with dballe.File("temp.bufr") as f:
    for binmsg in f:
        msgs = importer.from_binary(binmsg)
        for msg in msgs:
            print("#{b.index}: {m.report},{m.coords},{m.ident},{m.datetime},{m.type}".format(b=binmsg, m=msg))

class dballe.Importer same problem as above

https://arpa-simc.github.io/dballe/python/dballe_db.html the example:

https://arpa-simc.github.io/dballe/python/dballe_messages.html

get_named(name: str) → Union[dballe.Var, None]
    Get a Var given its shortcut name; returns None if not found

set_named(name: str, value: Union[dballe.Var, int, str, double])
    Set a Var given its shortcut name

which 'shortcut name' I can use ?

     msg.set_named("report", dballe.var("B01194", "sound"))
KeyError: "Shortcut name 'report' not found"
spanezz commented 4 years ago

I have just documented the shortcuts (see #206)

spanezz commented 4 years ago

I have implemented a way to execute and test all code snippets in the documentation. It should be quite unlikely that documentation bits do not compile or work, or use deprecated functions now.