Question:
How can I get 'batch' access to LAS data,
i.e. without going through the user interface?
Explanation:
If a Live Access Server has a lot of useful data, particularly if
it is regularly updated, it won't be long before people want to
automatically harvest the data. Although we've tried to make the
LAS user interface as friendly as possible, interactions with it
cannot be automated. To address the need for 'batch' access to LAS
data we have written a couple of scripts which can interact with LAS,
bypassing the user interface.
Solution:
We currently provide two scripts:
- ls.pl queries the server for dataset,
variable and axis information
- lasget.pl requests data from the server.
You can find out how to use the scripts by running them with no
arguments:
> ls.pl
Usage: ls.pl [-l] [-s separator] url [dataset] [variable]
-l displays descriptive name for a dataset or variable
and the type, units, and bounds of an axis.
-s separator delimit fields with separator
Example: ls.pl http://ferret.pmel.noaa.gov/las-bin/LASserver.pl
> lasget.pl
Usage: lasget.pl [-x xrange ] [-y yrange] [-z zrange]
[-t trange] [-f format] [-o file]
url dataset variable
-x xrange x range of data (-120, -120:80)
-y yrange y range of data (0, 0:90)
-z zrange z range of data (0, 0:20)
-t trange time range of data (1992-Dec-10, 1992-Jan-1:1992-Dec-1)
-o file output file. Defaults to stdout
-f format output format asc|cdf|txt|ps|html
url URL of LAS server
dataset name of dataset
variable name of variable
For More information, see the
LAS FAQ.
Note that these perl scripts require some additional perl modules
which may not have been previously installed on your system.
use LWP::UserAgent;
use URI::URL;
use URI::Escape;
use Getopt::Long;
use Getopt::Std;
You can pick up these modules by using the Perl CPAN module;
type perldoc CPAN for more info.