def piscesFileExist(days=get_all_available_days()): for dt in days: path = cfgv.nrt_mercator_pisces_raw + cfgv.nrt_mercator_pisces_prefix + str( dl.dateToDayn(dt)) + '.nc' print path if not os.path.isfile(path): print('The following file not found in the opedia vault: ' + path + ', Date: ' + dt.strftime('%Y-%m-%d')) return
def get_nrt_mercator_pisces_raw(dt): c1 = 'python motu-client.py -u mdehghaniashkez -p Jazireie08 -m http://nrtcmems.mercator-ocean.fr/motu-web/Motu -s GLOBAL_ANALYSIS_FORECAST_BIO_001_014-TDS -d dataset-global-analysis-forecast-bio-001-014 -x -180 -X 179.5 -y -89 -Y 90 -t "' c3 = '" -T "' c4 = '" -z 0.493 -Z 5727.918 -v Fe -v PP -v Si -v NO3 -v CHL -v PHYC -v PO4 -v O2 -o %s -f ' % cfgv.nrt_mercator_pisces_raw c2 = str(dt.year) + '-' + str(dt.month).zfill(2) + '-' + str( dt.day).zfill(2) + ' 12:00:00' c5 = cfgv.nrt_mercator_pisces_prefix + str(dl.dateToDayn(dt)) + '.nc' command = c1 + c2 + c3 + c2 + c4 + c5 os.system(command) return
def get_nrt_mercator_mld(dt): c1 = 'python motuclient.py ' + \ '--user mdehghaniashkez --pwd Jazireie08 ' + \ '--motu http://nrt.cmems-du.eu/motu-web/Motu ' + \ '--service-id GLOBAL_ANALYSIS_FORECAST_PHY_001_024-TDS ' + \ '--product-id global-analysis-forecast-phy-001-024 ' + \ '--longitude-min -180 --longitude-max 179.9166717529297 ' + \ '--latitude-min -80 --latitude-max 90 --date-min "' c3 = '" --date-max "' c4 = '" --depth-min 0.493 --depth-max 0.4942 --variable mlotst --out-dir %s --out-name ' % cfgv.nrt_mercator_mld_raw c2 = str(dt.year) + '-' + str(dt.month).zfill(2) + '-' + str(dt.day).zfill(2) + ' 12:00:00' c5 = cfgv.nrt_mercator_mld_prefix + str(dl.dateToDayn(dt)) + '.nc' command = c1 + c2 + c3 + c2 + c4 + c5 os.system(command) return
def get_nrt_mercator_pisces_raw(dt): c1 = 'python motuclient.py ' + \ '--user mdehghaniashkez --pwd Jazireie08 ' + \ '--motu http://nrt.cmems-du.eu/motu-web/Motu ' + \ '--service-id GLOBAL_ANALYSIS_FORECAST_BIO_001_014-TDS ' + \ '--product-id dataset-global-analysis-forecast-bio-001-014 ' + \ '--longitude-min -180 --longitude-max 179.5 ' + \ '--latitude-min -89 --latitude-max 90 --date-min "' c3 = '" --date-max "' c4 = '" --depth-min 0.493 --depth-max 5727.918000000001 --variable PHYC --variable O2 --variable NO3 --variable PO4 --variable Si --variable Fe --variable PP --variable CHL --out-dir %s --out-name ' % cfgv.nrt_mercator_pisces_raw c2 = str(dt.year) + '-' + str(dt.month).zfill(2) + '-' + str( dt.day).zfill(2) + ' 12:00:00' c5 = cfgv.nrt_mercator_pisces_prefix + str(dl.dateToDayn(dt)) + '.nc' command = c1 + c2 + c3 + c2 + c4 + c5 os.system(command) return
return ####### Check which files are missing piscesFileExist() ##################################### if len(sys.argv) <> 3: print('Enter 2 arguments as follow: Year-Month-Day Year-Month-Day') exit() dt1 = datetime.strptime(sys.argv[1], '%Y-%m-%d') dt2 = datetime.strptime(sys.argv[2], '%Y-%m-%d') dt = dt1 while (dt <= dt2): try: dayn = dl.dateToDayn(dt) print('Dowloading Mercator_Pisces >>> date: %s, DayNumber: %s' % (datetime.strftime(dt, '%Y-%m-%d'), dayn)) get_nrt_mercator_pisces_raw(dt) except Exception as e: print('================================') print('Error on %s' % datetime.strftime(dt, '%Y-%m-%d')) print('Error Message: %s' % e.message) print('Short wait ....') sleep(10) print('================================') get_nrt_mercator_pisces_raw(dt) dt = dt + timedelta(days=7)
inF.close() outF.close() return if len(sys.argv)<>4: print('Enter 3 arguments as follow: Year Month Day') exit() ###### only get today data ##### today = datetime.datetime.now().date() get_nrt_uv_adt_ftp(today.year, today.month, today.day) dml.updateChecklist(dl.dateToDayn(today), today.year, today.month, today.day, 'NRT_UV_ADT_Raw', 1) ################################ ''' yr = int(sys.argv[1]) startDay = int(sys.argv[2]) endDay = int(sys.argv[3]) for index in range(startDay,endDay+1): dt = dl.daynToDate(yr * 1000 + index) get_nrt_uv_adt_ftp(dt.year, dt.month, dt.day) '''