skip to navigation
skip to content

Not Logged In

ADAM-Tools 0.21dev

ADAM Reflectance Database Toolkit

Latest Version: 0.27dev

Some words about the ADAM Tools here.

More info can be found at the ADAM website here: http://www.noveltis.fr/adam-demo/

Installing

The ADAM-Tools are implemented in pure python, meaning there is no need to 'install' them as such, they can be simply imported into your Python scripts and used. This may be the best option if you plan on modifying the ADAM-Tools source code yourself for example, as you can store the code wherever you like.

If you do not intend to make modifications to the tools the best option is to let Python install them in a central location so all your scripts will be able to import them without specifying where they are.

To install using the Python module manager "easy_install", issue from the command line (linux users may need to preceed command with "sudo"):

$ easy_install ADAM-Tools

Note this assumes that easy_install is in your path. If you are using windows and the result of the above is "Bad command or file name" you need to include the specific path to easy_install, something like this:

# windows with no python in path:
c:\python26\scripts\easy_install ADAM-Tools

In the case where an older version may already be installed, you can request a specific version be installed like this:

$ easy_install ADAM-Tools==0.14dev

where 0.13dev is the version required. Note this will overwrite any older versions.

If for some reason easy_install does not work, ADAM-Tools can be installed manually. To do this, download and unzip the source package below. Start a command prompt in the install directory, and issue:

$ python setup.py install

Usage

Configuration

Since version 0.13dev, the configuration parameters of the ADAM Tools can be supplied as parameters when instantiating a new job. This allows the entire ADAM codebase to be replaced during an upgrade without losing site-specific config information.

For example, we start all ADAM scripts like this:

import adam
import adam_config

my_path_data       = 'c://ADAM-data/'
my_output_root_dir = 'c://ADAM-output/'
# get an instance of an adam 'config' object, this will be attached to any jobs we run
my_config = adam_config.adam_config(path_data = my_path_data, output_root_dir = my_output_root_dir)

ADAM Jobs

Once created, the config is then used as a parameter for all the jobs that follow.

For example, a spectrum graph can be generated like this (note the cfg = my_config):

request_dict = {'fieldOperationType': 'spectrum',
                'fieldMonth'        : 'jan',
                'fieldSunZenith'    : 40,
                'fieldViewZenith'   : 30,
                'fieldRelAzimuth'   : 0,
                'fieldCorner1Lat'   : 36.2,
                'fieldCorner1Lon'   : -5.5,
                'fieldCorner2Lat'   : 36,
                'fieldCorner2Lon'   : -5.2
}
job = adam.adam_job( cfg = my_config )
if not job.validate_input(request_dict):
    raise Exception('request input invalid !')
job.load_data()
job.process_reflectance()
job.process_brdf()
# make graph of land pixels (stored in the output directory specified in our configuration)
job.graph_main_ref_spectra(case='pixels', indices=job.data['idx_land'], title='Land pixel statistics')
# save results to a netCDF (stored in the output directory specified in our configuration)
job.save_netcdf()

Command Line Example

An example of launching an ADAM calculation from the command line is provided, brdf_commandline.py.

An example of its usage is given here:

$ python brdf_commandline.py --sza 30.0 --vza 40.0 --phi 0.0 --lat1 36.0 --lon1 5.2 \
  --lat2 36.2 --lon2 5.5 --wave-min 437 --wave-max 437 --month jan -ot brdf --netcdf-output /mydata/output.nc

More information about the commandline tool can be had by viewing the help:

$ python brdf_commandline.py --help
usage: brdf_commandline.py [-h] [--sza SZA] [--vza VZA]
                                 [--phi PHI] --lat1 LAT1 --lon1 LON1
                                 --lat2 LAT2 --lon2 LON2
                                 [--wave-min WAVE_MIN]
                                 [--wave-max WAVE_MAX]
                                 [--month {jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec}]
                                 --operation-type {brdf,spectrum}
                                 [--netcdf-output NETCDF_OUTPUT]

ADAM commandline options

optional arguments:
  -h, --help            show this help message and exit
  --sza SZA             Sun Zenith Angle (default 45)
  --vza VZA             View Zenith Angle (default 45)
  --phi PHI             Phi (default 0)
  --lat1 LAT1           Latitude 1
  --lon1 LON1           Longitude 1
  --lat2 LAT2           Latitude 2
  --lon2 LON2           Longitude 1
  --wave-min WAVE_MIN   Wavelength min
  --wave-max WAVE_MAX   Wavelength max
  --month {jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec}
                        Month
  --operation-type {brdf,spectrum}
                        Type of operation to perform
  --netcdf-output NETCDF_OUTPUT
                        Name of netcdf output filename

Other Examples

There are a collection of example scripts using the toolkit provided in the test/ folder in the downloadable.

More info can be found at the ADAM website here: http://www.noveltis.fr/adam-demo/

 
File Type Py Version Uploaded on Size
ADAM-Tools-0.21dev.tar.gz (md5) Source 2012-09-10 49KB
  • Downloads (All Versions):
  • 15 downloads in the last day
  • 224 downloads in the last week
  • 865 downloads in the last month