You are here: Home Tutorials Web services Example : getting the list of products matching user defined criteria

Example : getting the list of products matching user defined criteria

The getgranulelist script

This script is written in python language and uses standard packages. It has been tested with python2.6 and python2.7, slight changes may be necessary for a different version. The main task of the script is to build the URL of the query to the webservice offering this operation and then calling this URL, so it can be very easily adapted to any of your favorite language. An example of such a call is given below.In case of any issue, feel free to This email address is being protected from spambots. You need JavaScript enabled to view it. .

Please download the script here.

Usage

getgranulelist [options]

Options 
-h, --help show this help message and exit
-p identifier, --product=identifier collection (dataset) to search for granules
-d date,date, --date=date,date start and end dates for which to the search the dataset granules, expressed as <start,stop> with each
date as <YYYY-MM-DDThh:mm:ss>

-b minLat,maxLat,minLon,maxLon,

-bbox= minLat,maxLat,minLon,maxLon

geographical selection frame, expressed a <minLat,maxLat,minLon,maxLon> with longitudes (between  -180 and 180) and latitudes (between -90 and 90) in degrees (ex: --bbox=-80/80/-180/180)

-l, --list

list some of the available products

-u, --url  

list also the available URLs for each product

Example

Getting orbit files (L2P) for geophysical product from GHRSST METOP-A SST product (product id = EUR-L2P-AVHRR_METOP_A, refer to the product description pages or use getgranulelist --list to see available products), in Mediterranean Sea area on 25th May 2012. The --url option will display the corresponding file FTP link in addition to the file name.

getgranulelist -p EUR-L2P-AVHRR_METOP_A --date=2012-05-25T00:00:00,2012-05-25T12:00:00 --bbox=30.,46.,-10.,36.5 --url

The script will return the following result :

QUERYING..... http://www.ifremer.fr/naiad/naiad/services-2.3.1/index.php?method=GetListOfGranules&amp;AUTHENTICATION=guest&amp;TIME=2012-05-25T00:00:00/2012-05-25T12:00:00&amp;COLLECTION=EUR-L2P-AVHRR_METOP_A&amp;BBOX=-10.,30.,36.5,46.&amp;URL=true&amp;PUBLIC=true

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_063703-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_063703-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_064003-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_064003-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_064303-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_064303-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_081603-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_081603-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_081903-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_081903-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_082203-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_082203-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_095803-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_095803-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_100103-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_100103-v01.7-fv01.0.nc.bz2

20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_100403-v01.7-fv01.0.nc

ftp://c1f2a8:This email address is being protected from spambots. You need JavaScript enabled to view it. /cersat-rt/project/osi-saf/data/sst/l2p/avhrr_metop_a/2012/146/20120525-EUR-L2P_GHRSST-SSTsubskin-AVHRR_METOP_A-eumetsat_sstmgr_metop02_20120525_100403-v01.7-fv01.0.nc.bz2

Adapting the script

As shown on above example, the script actually just build and call the URL to a webservice then parse and display the result to user's console. It is then quite easy to perform the same task in any other language provided you just build correctly the URL which is quite straightforward to understand. In above example, the corresponding URL is displayed on console :

http://www.ifremer.fr/naiad/naiad/services-2.3.1/index.php?method=GetListOfGranules&AUTHENTICATION=guest&TIME=2012-05-25T00:00:00/2012-05-25T12:00:00&COLLECTION=EUR-L2P-AVHRR_METOP_A&BBOX=-10.,30.,36.5,46.&URL=true&PUBLIC=true

  • the geographical selection area is expressed as : BBOX=east lon,south lat, west lon, north lat
  • URL=true specifies that the file URLs should be displayed too
  • PUBLIC=true specifies that only the public URL (ftp in the context of GlobWave) should be displayed