sen2r (version 1.2.1)

safe_shortname: Rename products using a shorten convention

Description

This function renames a Sentinel-2 product in order to obtain shorten names. See the details for the structure of the adopted schema (named "sen2r naming convention"). The function applies only to compact product names (not to single granule names), since it is thought to be applied to entire products. Old long names are no more supported.

Usage

safe_shortname(prod_name, prod_type = NULL, ext = NULL, res = "10m",
  tiles = NULL, force_tiles = NULL, full.name = TRUE,
  set.seed = NULL, multiple_names = NULL, abort = FALSE)

Arguments

prod_name

Input Sentinel-2 product name (it is not required that the file exists).

prod_type

(optional) Output product (default: TOA for L1C, BOA for L2A); see the details for the list of accepted products.

ext

(optional) Extension of the output filename (default: none).

res

(optional) Spatial resolution (one between '10m', '20m' or '60m'); default is '10m'. Notice that, choosing '10m' or '20m', bands with lower resolution will be rescaled to res. Band 08 is used with res = '10m', band 08A with res = '20m' and res = '60m'.

tiles

Deprecated (no more used).

force_tiles

Deprecated (no more used).

full.name

Logical value: if TRUE (default), all the input path is maintained (if existing); if FALSE, only basename is returned.

set.seed

Deprecated (no more used).

multiple_names

Deprecated (no more used).

abort

Logical parameter: if TRUE, the function aborts in case prod_type is not recognised; if FALSE (default), a warning is shown.

Value

Output product name

Details

ESA Sentinel-2 naming convention is particularly long-winded. So, the convention here adopted, named "sen2r naming convention", follows this schema:

S2mll_yyyymmdd_rrr_ttttt_ppp_rr.fff

where:

  • S2mll (length: 5) shows the mission ID (S2A or S2B) and the product level (1C or 2A);

  • yyyymmdd (length: 8) is the sensing date (e.g. 20170603 for 2017-06-03) ; the hour is skipped, since a single sensor can not pass two times in a day on the same tile);

  • rrr (length: 3) is the relative orbit number (e.g. 022);

  • ttttt (length: 5) is the tile number (e.g. 32TQQ);

  • ppp (length: 3) is the output product, being one of these: for level 1C:

    • TOA: 13-bands Top-Of-Atmosphere Reflectance; for level 2A:

    • BOA: 13-bands Bottom-Of-Atmosphere Reflectance;

    • TCI: True Colour Image (3-band RGB 8-bit image);

    • AOT: Aerosol Optical Thickness;

    • WVP: Water Vapour;

    • SCL: Scene Classification Map;

    • CLD: Quality Indicators for cloud probabilities;

    • SNW: Quality Indicators for snow probabilities;

    • VIS: TODO Visibility (used for AOT);

  • rr (length: 2) is the original minimum spatial resolution in metres (10, 20 or 60);

  • fff (length: variable, generally 3) is the file extension.

Examples

Run this code
# NOT RUN {
safe_shortname("S2A_MSIL1C_20170603T101031_N0205_R022_T32TQQ_20170603T101026.SAFE", ext="tif")
# }

Run the code above in your browser using DataLab