Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
trngbich committed Apr 3, 2023
2 parents 26c455f + 525c9ff commit d8972bc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/IHEWAcollect/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ def __init__(self, product, is_print):
"""Class instantiation
"""
# Class self.__status['is_print']
self.__status['code'] = 0
vname, rtype, vdata = 'is_print', bool, is_print
if self.check_input(vname, rtype, vdata):
self.__status['is_print'] = vdata
else:
self.__status['code'] = 1

# Class self.__conf['product']['name']
self.__conf['product']['name'] = product

Expand All @@ -113,7 +113,6 @@ def __init__(self, product, is_print):
v=self.__conf['product']['name'])
else:
raise IHEClassInitError('Base') from None

def _conf(self,):
"""Get configuration
Expand Down
8 changes: 4 additions & 4 deletions src/IHEWAcollect/templates/NASA/GLDAS.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ def get_download_args(latlim, lonlim, date,

# Adjust the lon, lat limits based on the grids of the data
lonlim = np.array([
(y_id[0] * prod_lon_size + prod_lon_w),
(y_id[1] * prod_lon_size + prod_lon_w)
(x_id[0] * prod_lon_size + prod_lon_w),
(x_id[1] * prod_lon_size + prod_lon_w)
], dtype=np.float)
latlim = np.array([
(x_id[0] * prod_lat_size + prod_lat_s),
(x_id[1] * prod_lat_size + prod_lat_s)
(y_id[0] * prod_lat_size + prod_lat_s),
(y_id[1] * prod_lat_size + prod_lat_s)
], dtype=np.float)
# [w,n]--[w,s]
# | |
Expand Down
2 changes: 1 addition & 1 deletion src/IHEWAcollect/templates/NASA/GPM.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def start_download(args) -> int:
try:
# Connect to server
conn = requests.get(url)
# conn.raise_for_status()
conn.raise_for_status()
except requests.exceptions.RequestException as err:
# Connect error
msg = 'Not able to download {fn}, from {sr}{dr}'.format(
Expand Down
1 change: 1 addition & 0 deletions src/IHEWAcollect/templates/NASA/JPL.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
IHEStringError, IHETypeError, IHEKeyError, IHEFileError, IHEPassError
except ImportError:
from IHEWAcollect.base.exception import IHEClassInitError,\
IHEStringError, IHETypeError, IHEKeyError, IHEFileError, IHEPassError
# from netCDF4 import Dataset

# IHEWAcollect Modules
Expand Down
9 changes: 6 additions & 3 deletions src/IHEWAcollect/templates/USGS/SSEBop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np
import pandas as pd
import requests

import time
# from requests.auth import HTTPBasicAuth
from joblib import Parallel, delayed

Expand Down Expand Up @@ -635,5 +635,8 @@ def clean(path,log_file,part_file_name):
for filename in files:
# print(filename)
if(part_file_name in filename):
os.remove(os.path.join(root, filename))

try:
os.remove(os.path.join(root, filename))
except:
time.sleep(5)
os.remove(os.path.join(root, filename))

0 comments on commit d8972bc

Please sign in to comment.