def main(path, test_args): # from pprint import pprint # Download __init__ for key, value in test_args.items(): print('\n{:>4s}' '{:>20s}{:>6s}{:>20s}{:>20s}{:>20s}\n' '{:->90s}'.format(key, value['product'], value['version'], value['parameter'], value['resolution'], value['variable'], '-')) IHEWAcollect.Download(workspace=path, product=value['product'], version=value['version'], parameter=value['parameter'], resolution=value['resolution'], variable=value['variable'], bbox=value['bbox'], period=value['period'], nodata=value['nodata'], is_status=False)
def main(): # Caution: # dec_jpeg2000: Unable to open JPEG2000 image within GRIB file. # Docker, pass! path = os.path.join( os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))) product = 'CFSR' version = 'v1' parameter = 'radiation' resolution = 'daily' variable = 'dlwsfc' bbox = { 'w': 118.0642363480000085, 'n': 10.4715946960000679, 'e': 126.6049655970000458, 's': 4.5872944970000731 } period = {'s': '2008-01-01', 'e': '2008-01-31'} nodata = -9999 IHEWAcollect.Download(workspace=path, product=product, version=version, parameter=parameter, resolution=resolution, variable=variable, bbox=bbox, period=period, nodata=nodata, is_status=False, is_save_temp=True, is_save_remote=True)
def main(): path = os.path.join( os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))) product = 'MOD16A2' version = 'v6' parameter = 'evapotranspiration' resolution = 'eight_daily' variable = 'ETA' bbox = { 'w': 118.0642363480000085, 'n': 10.4715946960000679, 'e': 126.6049655970000458, 's': 4.5872944970000731 } period = {'s': '2008-01-01', 'e': '2008-01-09'} nodata = -9999 IHEWAcollect.Download(workspace=path, product=product, version=version, parameter=parameter, resolution=resolution, variable=variable, bbox=bbox, period=period, nodata=nodata, is_status=False)
def main(): # Caution: # A 69618 pixels x 29007 lines x 1 bands Float32 image would be larger than 4GB # but this is the largest size a TIFF can be, and BigTIFF is unavailable. # Docker, pass! path = os.path.join( os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))) product = 'SoilGrids' version = 'v1' parameter = 'soil' resolution = '9s' variable = 'BDRICM' bbox = { 'w': 118.0642363480000085, 'n': 10.4715946960000679, 'e': 126.6049655970000458, 's': 4.5872944970000731 } period = {'s': None, 'e': None} nodata = -9999 IHEWAcollect.Download(workspace=path, product=product, version=version, parameter=parameter, resolution=resolution, variable=variable, bbox=bbox, period=period, nodata=nodata, is_status=False, is_save_temp=True, is_save_remote=True)
def main(): # Caution: # A 69618 pixels x 29007 lines x 1 bands Float32 image would be larger than 4GB # but this is the largest size a TIFF can be, and BigTIFF is unavailable. # Docker, pass! path = os.path.join( os.getcwd(), os.path.dirname(inspect.getfile(inspect.currentframe()))) product = 'ETmonitor' version = 'v1' parameter = 'evapotranspiration' resolution = 'monthly' variable = 'ETA' # variable = 'ETP' bbox = { 'w': 118.0642363480000085, 'n': 10.4715946960000679, 'e': 126.6049655970000458, 's': 4.5872944970000731 } period = {'s': '2008-01-01', 'e': '2008-01-31'} nodata = -9999 IHEWAcollect.Download(workspace=path, product=product, version=version, parameter=parameter, resolution=resolution, variable=variable, bbox=bbox, period=period, nodata=nodata, is_status=False)
def test_CFSR(): # path = os.path.join(__path_data, 'download') path = __path test_freq = 'D' test_units = 'W.m2' test_args = { '1a': { 'product': 'CFSR', 'version': 'v1', 'parameter': 'radiation', 'resolution': 'daily', 'variable': 'dlwsfc', 'bbox': { 'w': -19.0, 'n': 38.0, 'e': 55.0, 's': -35.0 }, 'period': { 's': '2007-01-01', 'e': '2007-01-01' }, 'nodata': -9999 } } for key, value in test_args.items(): IHEWAcollect.Download(workspace=path, product=value['product'], version=value['version'], parameter=value['parameter'], resolution=value['resolution'], variable=value['variable'], bbox=value['bbox'], period=value['period'], nodata=value['nodata'], is_status=False) date_s = pd.Timestamp(value['period']['s']) date_e = pd.Timestamp(value['period']['e']) date_dates = pd.date_range(date_s, date_e, freq=test_freq) ndates = len(date_dates) local_path = os.path.join(path, 'IHEWAcollect', value['variable'], 'download') test_fname = '{p}_{v}_{u}_{f}'.format( p=value['product'], v=value['version'], u=test_units, f=test_freq ) fnames = os.listdir(local_path) local_files = [] for fname in fnames: print(fname) if test_fname in fname: file = os.path.join(local_path, fname) if np.ceil(os.stat(file).st_size / 1024) > 0: local_files.append(file) nfiles = len(local_files) assert ndates == nfiles