Skip to content

Commit

Permalink
Merge pull request #22 from mhpi/plot_fixes
Browse files Browse the repository at this point in the history
Updating requirements file, environment file, and supported torch versions
  • Loading branch information
JiangtaoLiud authored Feb 21, 2024
2 parents f15eb41 + 8124bc3 commit b8a149c
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*__pycache__*
*mypy_cache*
output/
.idea/
hydroDL.egg-info/
7 changes: 3 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ dependencies:
- python=3.10.13=h955ad1f_0
- python-dateutil=2.8.2=pyhd3eb1b0_0
- python-tzdata=2023.3=pyhd3eb1b0_0
- pytorch=2.1.1=py3.10_cuda12.1_cudnn8.9.2_0
- pytorch==2.0.1
- pytorch-cuda=12.1=ha16c6d3_5
- pytorch-mutex=1.0=cuda
- pytz=2023.3.post1=py310h06a4308_0
Expand All @@ -160,9 +160,8 @@ dependencies:
- tbb=2021.8.0=hdb19cb5_0
- tk=8.6.12=h1ccaba5_0
- tomli=2.0.1=py310h06a4308_0
- torchaudio=2.1.1=py310_cu121
- torchtriton=2.1.0=py310
- torchvision=0.16.1=py310_cu121
- torchaudio==2.0.2
- torchvision==0.15.2
- tornado=6.3.3=py310h5eee18b_0
- tqdm=4.66.1=pyhd8ed1ab_0
- typing_extensions=4.7.1=py310h06a4308_0
Expand Down
2 changes: 1 addition & 1 deletion example/PUR/testPUR-Reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
for k in range(len(filePathLst)):
filePath = filePathLst[k]
dataPred[:, :, k] = pd.read_csv(
filePath, dtype=np.float, header=None
filePath, dtype=float, header=None
).values
# transform back to the original observation
temppred = camels.transNormbyDic(
Expand Down
2 changes: 1 addition & 1 deletion hydroDL/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = (0, 1, 4)
VERSION = (0, 1, 6)
__version__ = ".".join(map(str, VERSION))
8 changes: 4 additions & 4 deletions hydroDL/data/dbCsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def readDBinfo(*, rootDB, subset):
indSub = dfSubset.values.flatten()

crdFile = os.path.join(rootDB, rootName, "crd.csv")
crdRoot = pd.read_csv(crdFile, dtype=np.float, header=None).values
crdRoot = pd.read_csv(crdFile, dtype=float, header=None).values

indAll = np.arange(0, crdRoot.shape[0], dtype=np.int64)
if np.array_equal(indSub, np.array([-1])):
Expand Down Expand Up @@ -162,7 +162,7 @@ def readDataTS(*, rootDB, rootName, indSub, indSkip, yrLst, fieldName):
t1 = time.time()
dataFile = os.path.join(rootDB, rootName, str(yr), fieldName + ".csv")
dataTemp = pd.read_csv(
dataFile, dtype=np.float, skiprows=indSkip, header=None
dataFile, dtype=float, skiprows=indSkip, header=None
).values
k2 = k1 + dataTemp.shape[1]
data[:, k1:k2] = dataTemp
Expand All @@ -176,7 +176,7 @@ def readDataConst(*, rootDB, rootName, indSub, indSkip, fieldName):
# read data
dataFile = os.path.join(rootDB, rootName, "const", fieldName + ".csv")
data = pd.read_csv(
dataFile, dtype=np.float, skiprows=indSkip, header=None
dataFile, dtype=float, skiprows=indSkip, header=None
).values.flatten()
data[np.where(data == -9999)] = np.nan
return data
Expand All @@ -189,7 +189,7 @@ def readStat(*, rootDB, fieldName, isConst=False):
statFile = os.path.join(
rootDB, "Statistics", "const_" + fieldName + "_stat.csv"
)
stat = pd.read_csv(statFile, dtype=np.float, header=None).values.flatten()
stat = pd.read_csv(statFile, dtype=float, header=None).values.flatten()
return stat


Expand Down
4 changes: 2 additions & 2 deletions hydroDL/data/load_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def load_all_csv(self, var_s, var_type, select_date_list, csv_date_list):
path_xdata = os.path.join(
self.csv_path_s, str(year_int), var_s + ".csv"
)
df = pd.read_csv(path_xdata, dtype=np.float, header=None) # pixel, time
df = pd.read_csv(path_xdata, dtype=float, header=None) # pixel, time

df_a = df.values # pixel, time
if ndx_year == 0:
Expand All @@ -102,7 +102,7 @@ def load_all_csv(self, var_s, var_type, select_date_list, csv_date_list):

elif var_type in ["var_c"]:
path_cData = os.path.join(self.csv_path_s, "const", var_s + ".csv")
df = pd.read_csv(path_cData, dtype=np.float, header=None,) # pixel,
df = pd.read_csv(path_cData, dtype=float, header=None,) # pixel,

df_a = df.values # pixel,
data = df_a
Expand Down
6 changes: 3 additions & 3 deletions hydroDL/master/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def namePred(out, tRange, subset, epoch=None, doMC=False, suffix=None):
# for k in range(len(filePathLst)):
# filePath = filePathLst[k]
# dataPred[:, :, k] = pd.read_csv(
# filePath, dtype=np.float, header=None).values
# filePath, dtype=float, header=None).values
# isSigmaX = False
# if mDict['loss']['name'] == 'hydroDL.model.crit.SigmaLoss':
# isSigmaX = True
Expand Down Expand Up @@ -737,7 +737,7 @@ def test(
doMC=doMC,
)
# read predicted results
dataPred = pd.read_csv(tempfilePath, dtype=np.float, header=None).values
dataPred = pd.read_csv(tempfilePath, dtype=float, header=None).values
updateData = np.full(initobs.shape, 0.0)
updateData[:, 1:, 0] = dataPred[:, 0:-1]
updateData[:, fixIndex, :] = initobs[:, fixIndex, :]
Expand All @@ -761,7 +761,7 @@ def test(
dataPred = np.ndarray([obs.shape[0], obs.shape[1], len(filePathLst)])
for k in range(len(filePathLst)):
filePath = filePathLst[k]
dataPred[:, :, k] = pd.read_csv(filePath, dtype=np.float, header=None).values
dataPred[:, :, k] = pd.read_csv(filePath, dtype=float, header=None).values
isSigmaX = False
if mDict["loss"]["name"] == "hydroDL.model.crit.SigmaLoss" or doMC is not False:
isSigmaX = True
Expand Down
2 changes: 1 addition & 1 deletion hydroDL/utils/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def trans_norm(
if stat is None:
# stat = [90 percentile,10 percentile, mean,std]

stat = pd.read_csv(csv_path_s, dtype=np.float, header=None).values.flatten()
stat = pd.read_csv(csv_path_s, dtype=float, header=None).values.flatten()

if from_raw:
data_out = (data - stat[2]) / stat[3]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
torch==2.1.1
torch==2.0.1
matplotlib==3.8.0

cartopy
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
URL = "https://github.com/mhpi/hydroDL/"
EMAIL = "[email protected]"
AUTHOR = "MHPI"
REQUIRES_PYTHON = ">=3.0"
REQUIRES_PYTHON = ">=3.9"
VERSION = None

# The rest you shouldn't have to touch too much :)
Expand Down

0 comments on commit b8a149c

Please sign in to comment.