![]() |
| home | graph lib | utility lib | custom lib | auxiliary lib | tutorials | |
|
zeBIOUse .new("bio") to create the object for general binrary intput/output of data. Two special IO functions are include to read world coastline data and GRIB data. :open(file[, mode]) file - a string for file name.mode - string indicating read or write. Opens the file for read (default) or wite (mode = "w"). :read(bytes) bytes - number of bytes to read. Reads the specified number of bytes from the file. :write(ptr, bytes) ptr - a Lua lighuserdata pointing to the data.bytes - number of bytes to write. Writes the specified number of bytes pointed to by ptr to the file. :byte(index) index - a number as the data array index. Returns the data byte at the index as number. :byteswitch(bytes) bytes - number of bytes to switch. Switches byte for every number of specified bytes in the whole array. :seek(offset) offset - number of bytes to move the file pointer. Moves the file pointer by the offset from the current position. :rewind() Moves the file pointer to the beginning. :gotoend() Moves the file pointer to the end. :tell() Returns the current position of the file pointer. :getptr() Returns the pointer to the data, the data memory size, and the number of bytes read from the file. :gshhs(flag, west, east, south, north, arr) flag - a string indicating land, lake, island, or pond.west - a number for the start of longitude. east - a number for the end of longitude. south - a number for the start of latitude. north - a number for the end of latitude. arr - a zeArray object of double type to hold data. Reads coastline data from binary GSHHS files. The latitude range is -90 to 90 and the longitude range is 0 to 360. :grib([id, p, yy, mm, dd, hh, arr]) id - GRIB parameter ID.p - pressure layer. yy - year. mm - month. dd - day. hh - hour. arr - a zeArray object of double type to hold data. Without argument, the function prints all parameters' id, pressure layer, date, and region code in a file; othereise reads a specified daatset and returns the numbers of row and colomn and the region code of the dataset. |