コード例 #1
0
def process_VIIRS_L2_OC(viirsL1_ProductArchive, forceReprocess):
    print("Processing", viirsL1_ProductArchive, "...")
    viirsL2_Product = viirsL1_ProductArchive[:22].replace(
        'L1A_NPP', 'L2_NPP')  # V2014159100026.L2_NPP
    viirsL2_ProductPath = viirsL2_Path + viirsL2_Product
    if exists(viirsL2_ProductPath):
        if not forceReprocess:
            print("Output L2 product exists already. Continuing...")
            return True
    chdir(viirsL1_Path)
    tempPath = viirsL1_Path + ensureTrailingSlash('temp')
    if exists(tempPath):
        rmtree(tempPath)
    ensurePathExists(tempPath)
    untarCommand = "tar -C '" + tempPath + "' -xjf " + viirsL1_ProductArchive
    system(untarCommand)

    viirsL1File = glob(tempPath + 'SVM01_npp_d' + _date + '*_obpg_ops.h5')[
        0]  # SVM01_npp_d20140608_t1000270_e1001511_b13535_obpg_ops.h5
    viirsGEOFile = viirsL1File.replace(
        'SVM01',
        'GMTCO')  # GMTCO_npp_d20140608_t1000270_e1001511_b13535_obpg_ops.h5
    system("python " + getancScript + " " + viirsL1File)
    viirsAncFile = viirsL1_Path + basename(
        viirsL1File
    ) + '.anc'  # SVM01_npp_d20140608_t1000270_e1001511_b13535_obpg_ops.h5.anc
    with open(viirsAncFile, 'r') as anc:
        ancillary_info = anc.readlines()
    print(viirsL1File, viirsGEOFile, viirsL2_ProductPath)

    par_file_path = viirsL2_ProductPath + '.par'
    with open(par_file_path, 'w') as par_file:
        par_file.write(l2gen_io_params)
        par_file.write('ifile=' + viirsL1File + '\n')
        par_file.write('geofile=' + viirsGEOFile + '\n')
        par_file.write('ofile=' + viirsL2_ProductPath + '\n\n')
        par_file.write(l2gen_suite_params + '\n')
        par_file.write(l2gen_l2_params + '\n')
        par_file.write(l2gen_anc_params)
        par_file.writelines(ancillary_info)

    processing_call = l2genBinary + ' par=' + par_file_path
    system(processing_call)

    if exists(viirsL2_ProductPath):
        rmtree(tempPath)
        return True  # success
    else:
        return False
コード例 #2
0
def process_VIIRS_L2_OC(viirsL1_ProductArchive, forceReprocess):
    print("Processing", viirsL1_ProductArchive, "...")
    viirsL2_Product = viirsL1_ProductArchive[:22].replace('L1A_NPP', 'L2_NPP')  # V2014159100026.L2_NPP
    viirsL2_ProductPath = viirsL2_Path + viirsL2_Product
    if exists(viirsL2_ProductPath):
        if not forceReprocess:
            print("Output L2 product exists already. Continuing...")
            return True
    chdir(viirsL1_Path)
    tempPath = viirsL1_Path + ensureTrailingSlash('temp')
    if exists(tempPath):
        rmtree(tempPath)
    ensurePathExists(tempPath)
    untarCommand = "tar -C '" + tempPath + "' -xjf " + viirsL1_ProductArchive
    system(untarCommand)

    viirsL1File = glob(tempPath + 'SVM01_npp_d' + _date + '*_obpg_ops.h5')[0]   # SVM01_npp_d20140608_t1000270_e1001511_b13535_obpg_ops.h5
    viirsGEOFile = viirsL1File.replace('SVM01', 'GMTCO')                        # GMTCO_npp_d20140608_t1000270_e1001511_b13535_obpg_ops.h5
    system("python " + getancScript + " " + viirsL1File)
    viirsAncFile = viirsL1_Path + basename(viirsL1File) + '.anc'                # SVM01_npp_d20140608_t1000270_e1001511_b13535_obpg_ops.h5.anc
    with open(viirsAncFile, 'r') as anc:
        ancillary_info = anc.readlines()
    print(viirsL1File, viirsGEOFile, viirsL2_ProductPath)

    par_file_path = viirsL2_ProductPath + '.par'
    with open(par_file_path, 'w') as par_file:
        par_file.write(l2gen_io_params)
        par_file.write('ifile=' + viirsL1File + '\n')
        par_file.write('geofile=' + viirsGEOFile + '\n')
        par_file.write('ofile=' + viirsL2_ProductPath+'\n\n')
        par_file.write(l2gen_suite_params + '\n')
        par_file.write(l2gen_l2_params + '\n')
        par_file.write(l2gen_anc_params)
        par_file.writelines(ancillary_info)

    processing_call = l2genBinary + ' par=' + par_file_path
    system(processing_call)

    if exists(viirsL2_ProductPath):
        rmtree(tempPath)
        return True    # success
    else:
        return False
コード例 #3
0
    print 'e.g. 20120507 for May 7, 2012.'


argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date = str(argv[1])
_year = _date[:4]
_month = _date[4:6]
_day = _date[6:]
_doy = getDOY(_year, _month, _day)

modisL1B_subPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1B_subBasePath + _year) + _month) + _day)
modisGEO_subPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisGEO_subBasePath + _year) + _month) + _day)
modisL2_subPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL2_subBasePath + _year) + _month) + _day)

print _year, _month, _day, _doy
print l2gen_const_params
print modisL1B_subPath, modisGEO_subPath, modisL2_subPath

for _path in [modisL2_subPath]:
    if not exists(_path):
        print "Making directory: ", _path, " ..."
コード例 #4
0
    printUsage()
    exit(1)

_backdate = argv[1]
if len(_backdate) != 8:
    print("****************************")
    print("* year parameter malformed *")
    print("****************************")
    printUsage()
    exit(1)

_year = _backdate[:4]
print _year
param = 'chl'

modisL3_UTM_QLPath = ensureTrailingSlash(modisL3_TSM_UTM_QLPath  + _year)

srcList = listdir(modisL3_UTM_QLPath)
listSize = len(srcList)

# Liste bereinigen:
for a in range(listSize):
    for item in srcList:
        if not item.startswith('cb_ns_' + param + '_') or not item.find(_backdate) > 1 or not item.endswith('_eo_bc.png'):
            print("Removing " + item + ' from list.')
            srcList.remove(item)

exit_on_empty_list(srcList)
srcList.sort()
print(srcList)
コード例 #5
0

argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date  = str(argv[1])
_year  = _date[:4]
_month = _date[4:6]
_day   = _date[6:]
_doy   = getDOY(_year, _month, _day)

print _year, _month, _day, _doy

modisL1A_LACPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1A_LACBasePath + _year) + _month) + _day)
modisGEOPath     = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisGEOBasePath + _year) + _month) + _day)

modisL1B_LACPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_LACBasePath + _year) + _month) + _day)
modisL1B_HKMPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_HKMBasePath + _year) + _month) + _day)
modisL1B_QKMPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_QKMBasePath + _year) + _month) + _day)
modisL1B_OBCPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_OBCBasePath + _year) + _month) + _day)

for _path in [modisL1B_LACPath, modisL1B_HKMPath, modisL1B_QKMPath, modisL1B_OBCPath]:
    if not exists(_path):
        print "Making directory: ", _path, " ..."
        makedirs(_path)

try:
    srcList = listdir(modisL1A_LACPath)
except OSError:
コード例 #6
0
if argv[2] == '0':
    print_missing = False
elif argv[2] == '1':
    print_missing = True
else:
    printUsage()

_year = back_date[:4]
_month = back_date[4:6]
_day = back_date[6:]
_doy = getDOY(_year, _month, _day)
DOY = str(_doy).zfill(3)

inputDir = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1A_LACBasePath + _year) + _month) + _day)
#print("Processing date " + back_date + " (DOY = " + DOY + ") in " + inputDir + ".")
if exists(inputDir):
    inputList = listdir(inputDir)
else:
    print("-")
    exit(1)
#exit_on_empty_list(inputList)
# print(inputList)

num_missing = 0
for h in range(0, 24):
    _hour = str(h).zfill(2)
    for m in range(0, 60, 5):
        _minute = str(m).zfill(2)
コード例 #7
0
back_date = argv[1]
if len(back_date)!=8:
    print("****************************")
    print("* date parameter malformed *")
    print("****************************")
    printUsage()
    exit(1)

_year  = back_date[:4]
_month = back_date[4:6]
_day   = back_date[6:]
_doy   = getDOY(_year, _month, _day)
print("Processing date " + back_date + " (DOY = " + str(_doy)+ ").")

modisL3_TSMPath  = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL3_TSMBasePath  + _year) + _month) + _day)
modisL3_ECOHAMPath  = ensureTrailingSlash(modisL3_ECOHAMBasePath  + _year)

for _path in [modisL3_TSMPath, modisL3_ECOHAMPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
        makedirs(_path)

try:
    srcList = listdir(modisL3_TSMPath)
except OSError:
    print("Cannot open ", modisL3_TSMPath+ "! Now exiting...")
    exit(1)
else:
    listSize = exit_on_empty_list(srcList)
    print(listSize)
user = '******'       # Subscription user: bconsult  password: volcano:vie

ftp_dir = '/subscriptions/VIIRS/XM/' + user + '/' + subscription
print(ftp_dir)
ftp_connection = FTP(host=ftp_server, user=ftp_user, passwd=ftp_pass)
ftp_connection.cwd(ftp_dir)
ftp_listing = ftp_connection.nlst()
exit_on_empty_list(ftp_listing)
listing = filter_list(ftp_listing, extension='.hdf')
listing.sort()
# print(listing)

for product_name in listing:
    acq_year = product_name[1:5]
    acq_doy = product_name[5:8]
    acq_date = getDateFromDOY(_year=acq_year, DOY=acq_doy)
    download_dir = viirsL2_SubsBasePath + ensureTrailingSlash(str(acq_year)) + ensureTrailingSlash(str(acq_date.month).zfill(2)) + ensureTrailingSlash(str(acq_date.day).zfill(2))
    if not exists(download_dir):
        makedirs(download_dir)
    chdir(download_dir)
    if not exists(product_name):
        print("Downloading " + product_name + " to " + download_dir + "...")
        ftp_connection.retrbinary('RETR '+product_name, open(product_name, 'wb').write)
    else:
        print("Product already here. Continuing...")
        continue

ftp_connection.quit()

# product names:
# V2014146064402.L2_NPP.NorthSeaBalticSea.hdf
コード例 #9
0
elif parameters == 'sst':
    from bc.eodata.beam_processing.conf.paths import sst_graph_file as graph_file

_year = back_date[:4]
_month = back_date[4:6]
_day = back_date[6:]
_doy = getDOY(_year, _month, _day)
DOY = str(_doy).zfill(3)

print("Processing date " + back_date + " (DOY = " + DOY + ")...")

beamBinDir = beamHomeDir + 'bin/'
gptProcessor = beamBinDir + 'gpt.sh'  # bcserver7 (deployment)
#gptProcessor = '/Applications/beam-5.0/bin/gpt.command'     # bcmacpro1 (development)
modisL2_TSMPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL2_TSMBasePath + _year) + _month) + _day)
modisDailyPath = ensureTrailingSlash(
    ensureTrailingSlash(modisDailyBasePath + _year) + _month)

for _path in [modisDailyPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
        makedirs(_path)

try:
    srcList = listdir(modisL2_TSMPath)
except OSError:
    print("Cannot open ", modisL2_TSMPath + "! Now exiting...")
    exit(1)
else:
コード例 #10
0
    print 'where date is a string representing the date to process,'
    print 'e.g. 20120507 for May 7, 2012.'


argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date  = str(argv[1])
_year  = _date[:4]
_month = _date[4:6]
_day   = _date[6:]
_doy   = getDOY(_year, _month, _day)

viirsL1_Path = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(viirsL1A_BasePath + _year) + _month) + _day)
viirsL2_Path = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(viirsL2_BasePath  + _year) + _month) + _day)
if not exists(viirsL2_Path):
    makedirs(viirsL2_Path)

try:
    srcPathList=glob(viirsL1_Path + 'V' + _year + str(_doy) + '*tar.bz2')
except OSError:
    print("Cannot open ", viirsL1_Path + "! Now exiting...")
    exit(1)
else:
    exit_on_empty_list(srcPathList)

srcList=[basename(item) for item in srcPathList]
srcList.sort()
del srcPathList
コード例 #11
0
argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date = str(argv[1])
_year = _date[:4]
_month = _date[4:6]
_day = _date[6:]
_doy = getDOY(_year, _month, _day)

print(_year, _month, _day, _doy)

modisL1A_LACPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1A_LACBasePath + _year) + _month) + _day)
modisL1A_subPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1A_subBasePath + _year) + _month) + _day)
modisGEOPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisGEOBasePath + _year) + _month) + _day)
modisGEO_subPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisGEO_subBasePath + _year) + _month) + _day)

for _path in [modisL1A_subPath, modisGEOPath, modisGEO_subPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
        makedirs(_path)
コード例 #12
0

argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date  = str(argv[1])
_year  = _date[:4]
_month = _date[4:6]
_day   = _date[6:]
_doy   = getDOY(_year, _month, _day)

print _year, _month, _day, _doy

modisL1A_subPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1A_subBasePath + _year) + _month) + _day)
modisGEO_subPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisGEO_subBasePath + _year) + _month) + _day)

modisL1B_subPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_subBasePath + _year) + _month) + _day)
modisL1B_HKMPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_HKMBasePath + _year) + _month) + _day)
modisL1B_QKMPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_QKMBasePath + _year) + _month) + _day)
modisL1B_OBCPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_OBCBasePath + _year) + _month) + _day)

for _path in [modisL1B_subPath, modisL1B_HKMPath, modisL1B_QKMPath, modisL1B_OBCPath]:
    if not exists(_path):
        print "Making directory: ", _path, " ..."
        makedirs(_path)

try:
    srcList = listdir(modisL1A_subPath)
except OSError:
コード例 #13
0
    print 'e.g. 20120507 for May 7, 2012.'


argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date = str(argv[1])
_year = _date[:4]
_month = _date[4:6]
_day = _date[6:]
_doy = getDOY(_year, _month, _day)

viirsL1_Path = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(viirsL1A_BasePath + _year) + _month) + _day)
viirsL2_Path = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(viirsL2_BasePath + _year) + _month) + _day)
if not exists(viirsL2_Path):
    makedirs(viirsL2_Path)

try:
    srcPathList = glob(viirsL1_Path + 'V' + _year + str(_doy) + '*tar.bz2')
except OSError:
    print("Cannot open ", viirsL1_Path + "! Now exiting...")
    exit(1)
else:
    exit_on_empty_list(srcPathList)
コード例 #14
0
ftp_dir = '/subscriptions/VIIRS/XM/' + user + '/' + subscription
print(ftp_dir)
ftp_connection = FTP(host=ftp_server, user=ftp_user, passwd=ftp_pass)
ftp_connection.cwd(ftp_dir)
ftp_listing = ftp_connection.nlst()
exit_on_empty_list(ftp_listing)
listing = filter_list(ftp_listing, extension='.hdf')
listing.sort()
# print(listing)

for product_name in listing:
    acq_year = product_name[1:5]
    acq_doy = product_name[5:8]
    acq_date = getDateFromDOY(_year=acq_year, DOY=acq_doy)
    download_dir = viirsL2_SubsBasePath + ensureTrailingSlash(
        str(acq_year)) + ensureTrailingSlash(str(
            acq_date.month).zfill(2)) + ensureTrailingSlash(
                str(acq_date.day).zfill(2))
    if not exists(download_dir):
        makedirs(download_dir)
    chdir(download_dir)
    if not exists(product_name):
        print("Downloading " + product_name + " to " + download_dir + "...")
        ftp_connection.retrbinary('RETR ' + product_name,
                                  open(product_name, 'wb').write)
    else:
        print("Product already here. Continuing...")
        continue

ftp_connection.quit()
try:
    backDay = int(argv[2])
except TypeError:
    print("backDay parameter must be of integer type.")
    printUsage()
    exit(1)

_now = datetime.now()   # start time of computing

_back_date = getBackDate(backDay)
_year  = str(_back_date.year)
_month = str(_back_date.month)
_day   = str(_back_date.day)
DOY    = str(getBackDOY(backDay=backDay, _year=int(_year)))

inputPath += ensureTrailingSlash(str(_year)) + ensureTrailingSlash(str(_month).zfill(2)) + ensureTrailingSlash(str(_day).zfill(2))
if not exists(inputPath):
    makedirs(inputPath)

chdir(inputPath)

min_acq_time = 8    # we start download for 8 o'clock data
max_acq_time = 15   # stop time of acq in our ROI

time_interval = [str(t).zfill(2) for t in range(min_acq_time, max_acq_time)]

print("Downloading products to: " + getcwd())

def wgetProducts():
    wget_cmd  = "wget -nc -S -O - http://oceandata.sci.gsfc.nasa.gov/" + sensor + "/" + prodLevel + "/" + _year + "/" + DOY
    grep_expr = "|grep V" + _year + DOY + hour + "|grep " + prodLevel + prodExtension
コード例 #16
0
    print 'e.g. 20120507 for May 7, 2012.'


argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date  = str(argv[1])
_year  = _date[:4]
_month = _date[4:6]
_day   = _date[6:]
_doy   = getDOY(_year, _month, _day)


modisL1B_subPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1B_subBasePath + _year) + _month) + _day)
modisGEO_subPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisGEO_subBasePath + _year) + _month) + _day)
modisL2_subPath  = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL2_subBasePath  + _year) + _month) + _day)

print _year, _month, _day, _doy
print l2gen_const_params
print modisL1B_subPath, modisGEO_subPath, modisL2_subPath

for _path in [modisL2_subPath]:
    if not exists(_path):
        print "Making directory: ", _path, " ..."
        makedirs(_path)

try:
    srcList = listdir(modisL1B_subPath)
except OSError:
コード例 #17
0
    from bc.eodata.beam_processing.conf.paths import wac_graph_file as graph_file
elif parameters=='sst':
    from bc.eodata.beam_processing.conf.paths import sst_graph_file as graph_file

_year  = back_date[:4]
_month = back_date[4:6]
_day   = back_date[6:]
_doy   = getDOY(_year, _month, _day)
DOY = str(_doy).zfill(3)

print("Processing date " + back_date + " (DOY = " + DOY + ")...")

beamBinDir  = beamHomeDir + 'bin/'
gptProcessor = beamBinDir + 'gpt.sh'                       # bcserver7 (deployment)
#gptProcessor = '/Applications/beam-5.0/bin/gpt.command'     # bcmacpro1 (development)
modisL2_TSMPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL2_TSMBasePath  + _year) + _month) + _day)
modisDailyPath  = ensureTrailingSlash(ensureTrailingSlash(modisDailyBasePath + _year) + _month)

for _path in [modisDailyPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
        makedirs(_path)

try:
    srcList = listdir(modisL2_TSMPath)
except OSError:
    print("Cannot open ", modisL2_TSMPath+ "! Now exiting...")
    exit(1)
else:
    listSize = exit_on_empty_list(srcList)
コード例 #18
0

beamBinDir  = beamHomeDir + 'bin/'
gptProcessor = beamBinDir + 'gpt.sh'

num_days_in_l3 = 7
_year  = int(back_date[:4])
_month = int(back_date[4:6])
_day   = int(back_date[6:])
proc_datetime = date(_year, _month, _day)
delta_days = (date.today() - proc_datetime).days
day_list = [getBackDate(day) for day in range(delta_days, delta_days + num_days_in_l3)]

srcList = []
for item in day_list:
    modisL2_TSMPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL2_TSMBasePath  + str(item.year))
                                                              + str(item.month).zfill(2)) + str(item.day).zfill(2))
    srcList += glob(modisL2_TSMPath+'A' + str(item.year) + '*.L2_TSM.dim')

exit_on_empty_list(srcList)
srcList.sort()
srcList = ",".join(srcList)

modisWeeklyPath  = ensureTrailingSlash(ensureTrailingSlash(modisWeeklyBasePath + str(_year)) + str(_month).zfill(2))
dateRangeString = str(day_list[6].year) + str(day_list[6].month).zfill(2) + str(day_list[6].day).zfill(2) + '_' + \
                  str(day_list[0].year) + str(day_list[0].month).zfill(2) + str(day_list[0].day).zfill(2)

outputProductPath = modisWeeklyPath + dateRangeString + regiondestID + parameters + '_bc_mod_1200.dim'

for _path in [modisWeeklyPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
コード例 #19
0
argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date = str(argv[1])
_year = _date[:4]
_month = _date[4:6]
_day = _date[6:]
_doy = getDOY(_year, _month, _day)

print _year, _month, _day, _doy

modisL1A_LACPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1A_LACBasePath + _year) + _month) + _day)
modisGEOPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisGEOBasePath + _year) + _month) + _day)

modisL1B_LACPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1B_LACBasePath + _year) + _month) + _day)
modisL1B_HKMPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1B_HKMBasePath + _year) + _month) + _day)
modisL1B_QKMPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL1B_QKMBasePath + _year) + _month) + _day)
modisL1B_OBCPath = ensureTrailingSlash(
コード例 #20
0
back_date = argv[1]
if len(back_date)!=8:
    print("****************************")
    print("* date parameter malformed *")
    print("****************************")
    printUsage()
    exit(1)

_year  = back_date[:4]
_month = back_date[4:6]
_day   = back_date[6:]
_doy   = getDOY(_year, _month, _day)
print("Processing date " + back_date + " (DOY = " + str(_doy)+ ").")

modisL3_TSMPath  = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL3_TSMBasePath  + _year) + _month) + _day)
modisL3_UTMPath  = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL3_TSM_UTMPath  + _year) + _month) + _day)
modisL3_UTM_QLPath = ensureTrailingSlash(modisL3_TSM_UTM_QLPath  + _year)

for _path in [modisL3_UTMPath, modisL3_UTM_QLPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
        makedirs(_path)

try:
    srcList = listdir(modisL3_TSMPath)
except OSError:
    print("Cannot open ", modisL3_TSMPath+ "! Now exiting...")
    exit(1)
else:
    listSize = exit_on_empty_list(srcList)
コード例 #21
0
back_date = argv[1]
if len(back_date) != 8:
    print("****************************")
    print("* date parameter malformed *")
    print("****************************")
    printUsage()
    exit(1)

_year = back_date[:4]
_month = back_date[4:6]
_day = back_date[6:]
_doy = getDOY(_year, _month, _day)
print("Processing date " + back_date + " (DOY = " + str(_doy) + ").")

modisL3_TSMPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL3_TSMBasePath + _year) + _month) + _day)
modisL3_UTMPath = ensureTrailingSlash(
    ensureTrailingSlash(
        ensureTrailingSlash(modisL3_TSM_UTMPath + _year) + _month) + _day)
modisL3_UTM_QLPath = ensureTrailingSlash(modisL3_TSM_UTM_QLPath + _year)

for _path in [modisL3_UTMPath, modisL3_UTM_QLPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
        makedirs(_path)

try:
    srcList = listdir(modisL3_TSMPath)
except OSError:
    print("Cannot open ", modisL3_TSMPath + "! Now exiting...")
コード例 #22
0
    printUsage()

if argv[2] == '0':
    print_missing = False
elif argv[2] == '1':
    print_missing = True
else:
    printUsage()

_year  = back_date[:4]
_month = back_date[4:6]
_day   = back_date[6:]
_doy   = getDOY(_year, _month, _day)
DOY = str(_doy).zfill(3)

inputDir = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1A_LACBasePath  + _year) + _month) + _day)
#print("Processing date " + back_date + " (DOY = " + DOY + ") in " + inputDir + ".")
if exists(inputDir):
    inputList = listdir(inputDir)
else:
    print("-")
    exit(1)
#exit_on_empty_list(inputList)
# print(inputList)

num_missing = 0
for h in range(0,24):
    _hour = str(h).zfill(2)
    for m in range(0, 60, 5):
        _minute = str(m).zfill(2)
        filename = 'A' + _year + DOY + _hour + _minute + '00.L1A_LAC.bz2'

argc = len(argv)
if argc < 2:
    printUsage()
    exit(1)

_date  = str(argv[1])
_year  = _date[:4]
_month = _date[4:6]
_day   = _date[6:]
_doy   = getDOY(_year, _month, _day)

print(_year, _month, _day, _doy)

modisL1A_LACPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1A_LACBasePath + _year) + _month) + _day)
modisL1A_subPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisL1A_subBasePath + _year) + _month) + _day)
modisGEOPath     = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisGEOBasePath     + _year) + _month) + _day)
modisGEO_subPath = ensureTrailingSlash(ensureTrailingSlash(ensureTrailingSlash(modisGEO_subBasePath + _year) + _month) + _day)

for _path in [modisL1A_subPath, modisGEOPath, modisGEO_subPath]:
    if not exists(_path):
        print("Making directory: ", _path, " ...")
        makedirs(_path)

try:
    srcList = listdir(modisL1A_LACPath)
except OSError:
    print("Cannot open ", modisL1A_LACPath+ "! Now exiting...")
    exit(1)
else:
コード例 #24
0
try:
    backDay = int(argv[2])
except TypeError:
    print("backDay parameter must be of integer type.")
    printUsage()
    exit(1)

_now = datetime.now()  # start time of computing

_back_date = getBackDate(backDay)
_year = str(_back_date.year)
_month = str(_back_date.month)
_day = str(_back_date.day)
DOY = str(getBackDOY(backDay=backDay, _year=int(_year)))

inputPath += ensureTrailingSlash(str(_year)) + ensureTrailingSlash(
    str(_month).zfill(2)) + ensureTrailingSlash(str(_day).zfill(2))
if not exists(inputPath):
    makedirs(inputPath)

chdir(inputPath)

min_acq_time = 8  # we start download for 8 o'clock data
max_acq_time = 15  # stop time of acq in our ROI

time_interval = [str(t).zfill(2) for t in range(min_acq_time, max_acq_time)]

print("Downloading products to: " + getcwd())


def wgetProducts():