I am having an issue somewhat related to this fix:
Fix(ModflowUzf1): load succeeding datasets if NUZF1..4 >= 0 #668
I am unable to load an existing MODFLOW-NWT model containing a UZF1 package because the load() function in mfuzf1.py assumes that there is only VKS input to read if IUZFOPT either 0 or 1:
# dataset 4
if iuzfopt in [0, 1]:
load_util2d("vks", np.float32)
Please correct me if I am wrong, but I thought that when using IUZFOPT = -1, one can still specify VKA. If so, the above line of the load() function should be updated:
# dataset 4
if abs(iuzfopt) in [0, 1]:
load_util2d("vks", np.float32)
This change in the load() function would be consistent with the existing code in the write_file() function of mfuzf1.py that checks for absolute value of IUZFOPT before writing VKS info to the UZF file:
# IF the absolute value of IUZFOPT = 1: Read item 4.
# Data Set 4
# [VKS (NCOL, NROW)] -- U2DREL
if abs(self.iuzfopt) in [0, 1]:
f_uzf.write(self.vks.get_file_entry())
After I tried this fix I ran into another issue:
The existing model UZF1 package specifies IETFLG = 1. The load() function currently tries to load data for all of PET, EXTDP, and EXTWC when IETFLG=1:
if ietflg > 0:
# dataset 11
line = line_parse(f.readline())
nuzf2 = pop_item(line, int)
if nuzf2 >= 0:
# dataset 12
load_util2d("pet", np.float32, per=per)
# dataset 13
line = line_parse(f.readline())
nuzf3 = pop_item(line, int)
if nuzf3 >= 0:
# dataset 14
load_util2d("extdp", np.float32, per=per)
# dataset 15
line = line_parse(f.readline())
nuzf4 = pop_item(line, int)
if nuzf4 >= 0:
# dataset 16
load_util2d("extwc", np.float32, per=per)
I think it should check for the value of IUZFOPT before attempting to load EXTWC because EXTWC is not valid input when IUZFOPT < 0:
if ietflg > 0:
# dataset 11
line = line_parse(f.readline())
nuzf2 = pop_item(line, int)
if nuzf2 >= 0:
# dataset 12
load_util2d("pet", np.float32, per=per)
# dataset 13
line = line_parse(f.readline())
nuzf3 = pop_item(line, int)
if nuzf3 >= 0:
# dataset 14
load_util2d("extdp", np.float32, per=per)
if iuzfopt > 0:
# dataset 15
line = line_parse(f.readline())
nuzf4 = pop_item(line, int)
if nuzf4 >= 0:
# dataset 16
load_util2d("extwc", np.float32, per=per)
This would be consistent with the write_file() function, where the code writes PET and EXTDP, then checks if IUZFOPT > 0 before writing EXTWC:
for n in range(nper):
write_transient("finf")
if self.ietflg > 0:
write_transient("pet")
write_transient("extdp")
if self.iuzfopt > 0:
write_transient("extwc")
Thank you!
I am having an issue somewhat related to this fix:
Fix(ModflowUzf1): load succeeding datasets if NUZF1..4 >= 0 #668
I am unable to load an existing MODFLOW-NWT model containing a UZF1 package because the load() function in mfuzf1.py assumes that there is only VKS input to read if IUZFOPT either 0 or 1:
Please correct me if I am wrong, but I thought that when using IUZFOPT = -1, one can still specify VKA. If so, the above line of the load() function should be updated:
This change in the load() function would be consistent with the existing code in the write_file() function of mfuzf1.py that checks for absolute value of IUZFOPT before writing VKS info to the UZF file:
After I tried this fix I ran into another issue:
The existing model UZF1 package specifies IETFLG = 1. The load() function currently tries to load data for all of PET, EXTDP, and EXTWC when IETFLG=1:
I think it should check for the value of IUZFOPT before attempting to load EXTWC because EXTWC is not valid input when IUZFOPT < 0:
This would be consistent with the write_file() function, where the code writes PET and EXTDP, then checks if IUZFOPT > 0 before writing EXTWC:
Thank you!