1515
1616
1717def set_ds_attrs (
18- ds , model_name , model_ws , mfversion = "mf6" , exe_name = None , version_tag = None
18+ ds ,
19+ model_name ,
20+ model_ws ,
21+ mfversion = "mf6" ,
22+ exe_name = None ,
23+ version_tag = None ,
24+ download_exe = True ,
1925):
2026 """Set the attribute of a model dataset.
2127
@@ -38,6 +44,9 @@ def set_ds_attrs(
3844 the most recent installation location of MODFLOW is found in flopy metadata
3945 that respects `version_tag`. If not found, the executables are downloaded.
4046 Not compatible with exe_name.
47+ download_exe : bool, optional
48+ If True, download the executable if it is not found locally. The default is
49+ True.
4150
4251 Returns
4352 -------
@@ -52,9 +61,17 @@ def set_ds_attrs(
5261 ds .attrs ["created_on" ] = dt .datetime .now ().strftime (fmt )
5362
5463 if exe_name is None :
55- exe_name = util .get_exe_path (exe_name = mfversion , version_tag = version_tag )
64+ exe_name = util .get_exe_path (
65+ exe_name = mfversion ,
66+ version_tag = version_tag ,
67+ download_if_not_found = download_exe ,
68+ )
5669 else :
57- exe_name = util .get_exe_path (exe_name = exe_name , version_tag = version_tag )
70+ exe_name = util .get_exe_path (
71+ exe_name = exe_name ,
72+ version_tag = version_tag ,
73+ download_if_not_found = download_exe ,
74+ )
5875
5976 ds .attrs ["exe_name" ] = exe_name
6077
@@ -87,6 +104,7 @@ def to_model_ds(
87104 transport = False ,
88105 remove_nan_layers = True ,
89106 version_tag = None ,
107+ download_exe = True ,
90108):
91109 """Transform an input dataset to a groundwater model dataset.
92110
@@ -150,6 +168,9 @@ def to_model_ds(
150168 the most recent installation location of MODFLOW is found in flopy metadata
151169 that respects `version_tag`. If not found, the executables are downloaded.
152170 Not compatible with exe_name.
171+ download_exe : bool, optional
172+ If True, download the executable if it is not found locally. The default is
173+ True.
153174
154175 Returns
155176 -------
@@ -189,7 +210,12 @@ def to_model_ds(
189210
190211 # add attributes
191212 ds = set_ds_attrs (
192- ds , model_name , model_ws , mfversion = "mf6" , version_tag = version_tag
213+ ds ,
214+ model_name ,
215+ model_ws ,
216+ mfversion = "mf6" ,
217+ version_tag = version_tag ,
218+ download_exe = download_exe ,
193219 )
194220 ds .attrs ["transport" ] = int (transport )
195221
@@ -538,6 +564,8 @@ def get_ds(
538564 extrapolate = True ,
539565 fill_nan = True ,
540566 transport = False ,
567+ version_tag = None ,
568+ download_exe = True ,
541569 ** kwargs ,
542570):
543571 """Create a model dataset from scratch.
@@ -607,9 +635,17 @@ def get_ds(
607635 transport : bool, optional
608636 flag indicating whether dataset includes data for a groundwater
609637 transport model (GWT). Default is False, no transport.
638+ version_tag : str, default None
639+ GitHub release ID: for example "18.0" or "latest". If version_tag is provided,
640+ the most recent installation location of MODFLOW is found in flopy metadata
641+ that respects `version_tag`. If not found, the executables are downloaded if
642+ download_exe is True (see below). Not compatible with exe_name.
643+ download_exe : bool, optional
644+ If True, download the executable if it is not found locally. The default is
645+ True.
610646 **kwargs : dict
611- Kwargs are passed into mbase.to_ds. These can be the model_name
612- or ds .
647+ Kwargs are passed into nlmod.to_model_ds(). See nlmod.to_model_ds() for
648+ more information .
613649
614650 Returns
615651 -------
@@ -707,6 +743,8 @@ def check_variable(var, shape):
707743 extrapolate = extrapolate ,
708744 fill_nan = fill_nan ,
709745 transport = transport ,
746+ version_tag = version_tag ,
747+ download_exe = download_exe ,
710748 ** kwargs ,
711749 )
712750 ds .rio .write_crs (crs , inplace = True )
0 commit comments