diff --git a/Collect/ALEXI/DataAccess.py b/Collect/ALEXI/DataAccess.py index 7d576f9..7ff5e97 100644 --- a/Collect/ALEXI/DataAccess.py +++ b/Collect/ALEXI/DataAccess.py @@ -186,6 +186,9 @@ def ALEXI_weekly(Date, Enddate, output_folder, latlim, lonlim, Year, Waitbar, to amount += 1 WaitbarConsole.printWaitBar(amount, total_amount, prefix = 'Progress:', suffix = 'Complete', length = 50) + # Delete original file + os.remove(local_filename) + # Check if this file must be downloaded Date = pd.Timestamp(Date) if Date.toordinal() > Stop: diff --git a/Collect/GPM/DataAccess.py b/Collect/GPM/DataAccess.py index dde856f..870dd0c 100644 --- a/Collect/GPM/DataAccess.py +++ b/Collect/GPM/DataAccess.py @@ -115,16 +115,15 @@ def RetrieveData(Date, args): # Create https if TimeCase == 'daily': - URL = 'https://gpm1.gesdisc.eosdis.nasa.gov/opendap/GPM_L3/GPM_3IMERGDF.06/%d/%02d/3B-DAY.MS.MRG.3IMERG.%d%02d%02d-S000000-E235959.V06.nc4.ascii?precipitationCal[0:1:0][%d:1:%d][%d:1:%d]' %(year, month, year, month, day, xID[0], xID[1]-1, yID[0], yID[1]-1) - DirFile = os.path.join(output_folder, "P_GPM_3IMERGDF.06_mm-day-1_daily_%d.%02d.%02d.tif" %(year, month, day)) + URL = 'https://gpm1.gesdisc.eosdis.nasa.gov/opendap/GPM_L3/GPM_3IMERGDF.06/%d/%02d/3B-DAY.MS.MRG.3IMERG.%d%02d%02d-S000000-E235959.V06.nc4.ascii?precipitationCal[0][%d:1:%d][%d:1:%d]' %(year, month, year, month, day, xID[0], xID[1]-1, yID[0], yID[1]-1) + DirFile = os.path.join(output_folder, "P_GPM.IMERG.V6_mm-day-1_daily_%d.%02d.%02d.tif" %(year, month, day)) Scaling = 1 if TimeCase == 'monthly': -# URL = 'https://gpm1.gesdisc.eosdis.nasa.gov/opendap/hyrax/GPM_L3/GPM_3IMERGM.06/%d/3B-MO.MS.MRG.3IMERG.%d%02d01-S000000-E235959.%02d.V06B.HDF5.ascii?precipitation[0:1:0][%d:1:%d][%d:1:%d]' %(year, year, month, month, xID[0], xID[1]-1, yID[0], yID[1]-1) - URL = 'https://gpm1.gesdisc.eosdis.nasa.gov/opendap/GPM_L3/GPM_3IMERGM.06/%d/3B-MO.MS.MRG.3IMERG.%d%02d01-S000000-E235959.%02d.V06B.HDF5.ascii?precipitation[0:1:0][%d:1:%d][%d:1:%d]' %(year, year, month, month, xID[0], xID[1]-1, yID[0], yID[1]-1) + URL = 'https://gpm1.gesdisc.eosdis.nasa.gov/opendap/hyrax/GPM_L3/GPM_3IMERGM.06/%d/3B-MO.MS.MRG.3IMERG.%d%02d01-S000000-E235959.%02d.V06B.HDF5.ascii?precipitation[0][%d:1:%d][%d:1:%d]' %(year, year, month, month, xID[0], xID[1]-1, yID[0], yID[1]-1) Scaling = calendar.monthrange(year,month)[1] * 24 - DirFile = os.path.join(output_folder, "P_GPM.IMERG_mm-month-1_monthly_%d.%02d.01.tif" %(year, month)) - + DirFile = os.path.join(output_folder, "P_GPM.IMERG.V6_mm-month-1_monthly_%d.%02d.01.tif" %(year, month)) + if not os.path.isfile(DirFile): dataset = requests.get(URL, allow_redirects=False,stream = True) try: diff --git a/Collect/TRMM/DataAccess.py b/Collect/TRMM/DataAccess.py index 548f396..a58bb27 100644 --- a/Collect/TRMM/DataAccess.py +++ b/Collect/TRMM/DataAccess.py @@ -120,11 +120,11 @@ def RetrieveData(Date, args): Scaling = 1 if TimeCase == 'monthly': - if Date >= pd.Timestamp('2010-10-01'): - URL = 'https://disc2.gesdisc.eosdis.nasa.gov/opendap/TRMM_L3/TRMM_3B43.7/%d/3B43.%d%02d01.7.HDF.ascii?precipitation[%d:1:%d][%d:1:%d]' %(year, year, month, xID[0], xID[1]-1, yID[0], yID[1]-1) + if Date >= pd.Timestamp('2000-01-01') and Date < pd.Timestamp('2010-10-01'): + URL = 'https://disc2.gesdisc.eosdis.nasa.gov/opendap/TRMM_L3/TRMM_3B43.7/%d/3B43.%d%02d01.7A.HDF.ascii?precipitation[%d:1:%d][%d:1:%d]' %(year, year, month, xID[0], xID[1]-1, yID[0], yID[1]-1) else: - URL = 'https://disc2.gesdisc.eosdis.nasa.gov/opendap/TRMM_L3/TRMM_3B43.7/%d/3B43.%d%02d01.7A.HDF.ascii?precipitation[%d:1:%d][%d:1:%d]' %(year, year, month, xID[0], xID[1]-1, yID[0], yID[1]-1) + URL = 'https://disc2.gesdisc.eosdis.nasa.gov/opendap/TRMM_L3/TRMM_3B43.7/%d/3B43.%d%02d01.7.HDF.ascii?precipitation[%d:1:%d][%d:1:%d]' %(year, year, month, xID[0], xID[1]-1, yID[0], yID[1]-1) Scaling = calendar.monthrange(year,month)[1] * 24 DirFile = os.path.join(output_folder, "P_TRMM3B43.V7_mm-month-1_monthly_%d.%02d.01.tif" %(year, month)) diff --git a/Collect_Tools.py b/Collect_Tools.py index 0d158ff..8082746 100644 --- a/Collect_Tools.py +++ b/Collect_Tools.py @@ -8,6 +8,7 @@ """ from __future__ import print_function # general modules +#test comment from future import standard_library standard_library.install_aliases() import urllib.request, urllib.parse, urllib.error