satmo.query module¶
-
satmo.query.
get_subscription_urls
(id)[source]¶ Send a request to a subscription number to get a list of download URLs
Parameters: id (int) – Ocean color subscription number Returns: A list of download urls
-
satmo.query.
make_download_url
(file_name, host='https://oceandata.sci.gsfc.nasa.gov/cgi/getfile/')[source]¶ Builds a download URL from a (L1A) file name
Simple helper that given a filename (obtained with query_from_extent for example), prepends the ‘getFile url’ of the oceancolor DAAC and appends ‘.gz’ when files are not netcdf.
In line with query_from_extent, this function is designed to work with L1A files from MODIS, VIIRS and SeaWifs. Untested for other sensors and other data levels.
Parameters: - file_name (str) – name of a L1A file present on oceancolor servers
- host (str) – Address of the root of the archive. DON’T FORGET TRAILING SLASH
Returns: A string of the URL at which the file can be downloaded (ready to be passed to download_robust)
-
satmo.query.
query_from_extent
(sensors, date_begin, per, north, south, west, east, day=True, night=True, product='L1A', base_url='https://oceancolor.gsfc.nasa.gov/cgi/browse.pl')[source]¶ Query L1A data for a given period and spatial extent
Uses an old school perl ‘API’ to get a list of filenames that intersect with a geographical area and a time period. The function was initially designed to query L1A products; capability to query different L2 collection was added later and may not function as well than the L1A query capability.
Parameters: - sensors – (list) list of strings, Valid entries are ‘am’ (aqua), ‘tm’ (terra),
- 'sw' (seawifs), 'v0' (viirs) –
- date_begin (datetime or str) – date of the first day of the period queried use ‘yyyy-mm-dd’ format if passing it as a string
- per (str) – The period queried. One of ‘DAY’, ‘MO’, ‘YR’
- north (float) – north latitude of bounding box in DD
- south (float) – south latitude of bounding box in DD
- west (float) – west longitude of bounding box in DD
- east (float) – east longitude of bounding box in DD
- day (bool) – Order day data ?
- night (bool) – Order night data ?
- product (str) – Product to order, defaults to ‘L1A’. Other possible values include ‘CHL’ for L2_OC, ‘SST’ for L2_SST, and ‘SST4’ for L2_SST4
- base_url (str) – ‘api’ host
Returns: List of filenames
Return type: list