ait.core.bin.ait_create_dirs module

Usage:
ait-create-dirs [options]

Arguments:

-d DATETIME, --datetime=<YYYY-MM-DDTHH:mm:ssZ>
 Create directory structure using this ISO 8601 datetime for strftime replacement in directory path. Default: TODAY

Description:

AIT Create Directory Structure

Based on the data paths specified in the AIT_CONFIG, this software creates daily directories for the GDS based on the paths and any applicable variable substitution.

Paths should be specified within the ‘data’ portion of the AIT_CONFIG. It should follow the following hierarchy within the YAML file:

data:
data-type:
path:

For example:

data:
type_a:
path: /path/to/data/type_a
type_b:
path: /path/to/data/type_b

Be sure to use ‘path’ to specify the data path so the software knows to translate these paths as needed. You can use absolute or relative paths:

data:
type_a:
path: to/data/type_a
type_b:
path: ~/to/data/type_b

Variable substituion is also possible using any of the default-, platform-, or host- level attributes within the AIT_CONFIG. To include a variable in a path use the following syntax, ${variable}

For example,

default:

mission: ‘oco3’ phase: ‘int’

data:
type_a:
path: /${mission}/${phase}/data/type_a
type_b:
path: /${mission}/${phase}/data/type_b

Will create the directories:

/oco3/int/data/type_a /oco3/int/data/type_b

There are also several special variables available: * hostname = current machine hostname * platform = platform of the current machine (darwin, win32, etc.)

You can also use strftime format characters (https://docs.python.org/2/library/time.html#time.strftime).

For example,

default:

mission: ‘oco3’ phase: ‘int’

data:
type_a:
path: /${mission}/${phase}/%Y/%Y-%j/type_a
type_b:
path: /${mission}/${phase}/%Y/%Y-%j/type_b

Will produce paths like (depending on the date):

/oco3/int/2016/2016-299/type_a /oco3/int/2016/2016-299/type_b
ait.core.bin.ait_create_dirs.createDirStruct(paths, verbose=True)

Loops ait.config._datapaths from AIT_CONFIG and creates a directory.

Replaces year and doy with the respective year and day-of-year. If neither are given as arguments, current UTC day and year are used.

Args:
paths:
[optional] list of directory paths you would like to create. doy and year will be replaced by the datetime day and year, respectively.
datetime:
UTC Datetime string in ISO 8601 Format YYYY-MM-DDTHH:mm:ssZ
ait.core.bin.ait_create_dirs.main()