seagrid.download.obpg#
File naming rules of NASA OB.DAAC Level-3 mapped products.
The Ocean Biology Distributed Active Archive Center names its L3 mapped files as:
<MISSION_SENSOR>.<period>.L3m.<code>.<suite>.<product>.<resolution>[.NRT].nc
AQUA_MODIS.20100101_20100131.L3m.MO.CHL.chlor_a.4km.nc
This module turns (dtm, data_var, timetype, sensor, resolution) into
file names, download URLs and NASA CMR collection short names. It has no
network code.
- ivar SENSOR_PREFIX:
File-name prefix of each sensor.
- vartype SENSOR_PREFIX:
- ivar CMR_PREFIX:
Prefix of the CMR collection short names of each sensor.
- vartype CMR_PREFIX:
- ivar PRODUCTS:
data_var -> (suite, product).- vartype PRODUCTS:
- ivar TIMETYPE_CODE:
Canonical time type -> OB.DAAC period code.
- vartype TIMETYPE_CODE:
- ivar GETFILE_URL:
Base URL for downloading a file by name.
- vartype GETFILE_URL:
Functions
|
Return the NASA CMR collection short name of an L3 mapped product. |
|
Return the OB.DAAC file name of an L3 mapped product. |
|
Return the period part of a file name. |
|
Return the |
|
Return the download URL of an OB.DAAC file. |
- seagrid.download.obpg.cmr_short_name(data_var, sensor='MODIS')[source]#
Return the NASA CMR collection short name of an L3 mapped product.
- Parameters:
- Returns:
str– E.g."MODISA_L3m_CHL".- Raises:
ValueError – If the sensor or variable has no known CMR collection.
- Return type:
Examples
>>> cmr_short_name("par") 'MODISA_L3m_PAR'
- seagrid.download.obpg.filename(dtm, data_var='chlor_a', timetype='daily', sensor='MODIS', resolution='4km', *, clim_years=None, nrt=False)[source]#
Return the OB.DAAC file name of an L3 mapped product.
- Parameters:
dtm (
str,pandas.Timestamp,numpy.datetime64ordatetime) – Any date in the period.data_var (
str, optional) – Variable, a key ofPRODUCTS. Default"chlor_a".timetype (
str, optional) –"daily","8day","monthly"or"climatology"(or an alias such as"DAY"or"mo"). Default"daily".sensor (
str, optional) – A key ofSENSOR_PREFIX. Default"MODIS"(Aqua).resolution (
str, optional) –"4km","9km", … Default"4km".clim_years (
(int,int), optional) – First and last year of a climatology.nrt (
bool, optional) – Near-real-time file (.NRT.nc). Default False.
- Returns:
- Return type:
Examples
>>> filename("2010-01-15", "par", "mo") 'AQUA_MODIS.20100101_20100131.L3m.MO.PAR.par.4km.nc' >>> filename("2023-03-15", "kd_490", "DAY", sensor="VIIRS", resolution="9km") 'SNPP_VIIRS.20230315.L3m.DAY.KD.Kd_490.9km.nc'
- seagrid.download.obpg.period_string(dtm, timetype='daily', clim_years=None)[source]#
Return the period part of a file name.
- Parameters:
dtm (
str,pandas.Timestamp,numpy.datetime64ordatetime) – Any date in the period.timetype (
str, optional) –"daily","8day","monthly"or"climatology"(or an alias). Default"daily".clim_years (
(int,int), optional) – First and last year of a climatology. Required for"climatology".
- Returns:
str–YYYYMMDDfor daily files,YYYYMMDD_YYYYMMDDotherwise.- Raises:
ValueError – For
"hourly"/"static", or a climatology without clim_years.- Return type:
Examples
>>> period_string("2010-02-11", "8day") '20100210_20100217' >>> period_string("2010-07-15", "climatology", clim_years=(2002, 2021)) '20020701_20210731'
- seagrid.download.obpg.url(name)[source]#
Return the download URL of an OB.DAAC file.
- Parameters:
name (
str) – File name, as fromfilename().- Returns:
- Return type:
Examples
>>> url("AQUA_MODIS.20100101.L3m.DAY.PAR.par.4km.nc") 'https://oceandata.sci.gsfc.nasa.gov/getfile/AQUA_MODIS.20100101.L3m.DAY.PAR.par.4km.nc'