#!/usr/bin/env python
"""
ctd_proc_tree.py: Make the folder structure in the CTD Processing
computer for a new cruise
USAGE:
c:\> python ctd_proc_tree.py cruisedir
EXAMPLE
c:\> python ctd_proc_tree.py AB0703
"""
#
# ctd_proc_tree.py: Make the folder structure in the CTD Processing
#  computer for a new cruise
#
# USAGE:
# c:\> python ctd_proc_tree.py cruisedir
# EXAMPLE
# c:\> python ctd_proc_tree.py AB0703
#

__author__ = "Carlos Fonseca <carlos.fonseca@noaa.gov>"

import os, sys

# Cruise Directory should be only input argument
cruise_dir = sys.argv[1].strip()

# Base directory is c:\DATA\
# CTDPROC should be set to the base path where most of the cruises reside.
base = os.environ['CTDPROC'] # c:\CTD_DATA\
print "base is %s"% base
#Processing directory 
procdir     = os.path.join(base,cruise_dir)

#Directory List
dirlist = ('1-BRUTOS',
'2-DATCNV',
'3-FILTER',
'4-ALIGNCTD',
'5-WILDEDIT',
'6-CELLTM',
'7-LOOPEDIT',
'8-DERIVE',
'9-BINAVG',
'10-SPLIT',
'11-STRIP',
'12-BOTSUM',
'13-SEAPLOT',
'14-SEAPLOT_TS',
'15-ASCII')

for dirname in dirlist:
    fulldir = os.path.join(procdir, dirname)
    if os.path.exists(fulldir):
        print 'directory exists: cannot make %s' %(fulldir)
        sys.exit()
    else:
        os.makedirs(fulldir, 0777)
        print 'making directory %s' %(fulldir)
