コード例 #1
0
 def test_colorado_plot(self):
     working_dir = os.path.join(self.output_path, "colorado")
     colorado_nam = os.path.join(working_dir, "mod16_ssfix_wel2.nam")
     colorado_geo = os.path.join(working_dir, "colorado.geo")
     mf = ModflowOutput(colorado_nam, config_file=colorado_geo, exe_name="mf2005", verbose=True, model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='heads', level=4).show()
コード例 #2
0
 def test_miami_dade_plot(self):
     working_dir = os.path.join(self.output_path, "miami-dade")
     miami_nam = os.path.join(working_dir, "UMD_fb.nam")
     miami_geo = os.path.join(working_dir, "miami-dade.geo")
     mf = ModflowOutput(miami_nam, config_file=miami_geo, exe_name="mf2005", verbose=True, model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='heads', colormap=matplotlib.cm.GnBu).show()
コード例 #3
0
 def test_freyberg_plot(self):
     working_dir = os.path.join(self.output_path, "freyberg")
     freyberg_nam = os.path.join(working_dir, "freyberg.nam")
     freyberg_geo = os.path.join(working_dir, "freyberg.geo")
     mf = ModflowOutput(freyberg_nam, config_file=freyberg_geo, exe_name="mf2005", verbose=True, model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='flow_right_face_centered', colormap=matplotlib.cm.GnBu).show()
コード例 #4
0
 def test_carolina_plot(self):
     working_dir = os.path.join(self.output_path, "carolina")
     carolina_nam = os.path.join(working_dir, "1-23-07_NOASP.nam")
     carolina_geo = os.path.join(working_dir, "carolina.geo")
     mf = ModflowOutput(carolina_nam, config_file=carolina_geo, exe_name="mf2005", verbose=True, model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='heads', colormap=matplotlib.cm.GnBu).show()
コード例 #5
0
 def test_plot(self):
     mf = ModflowOutput(self.resource,
                        config_file=self.wgs84_config_file,
                        exe_name="mf2005",
                        verbose=True)
     assert mf is not None
     mf.to_plot().show()
コード例 #6
0
ファイル: mod2net.py プロジェクト: jtwhite79/modflow2netcdf
def main(name_file, config_file, action, output=None, verbose=None):

    if verbose is True:
        logger.level = logging.DEBUG
    else:
        verbose = False
        logger.level = logging.INFO

    # Try to load files for immediate warnings back to the user
    try:
        with open(name_file) as f:
            f.read()
    except IOError:
        logger.info("Error opening namefile: {!s}".format(name_file))
        return

    try:
        with open(config_file) as f:
            f.read()
    except IOError:
        logger.info("Error opening configuration file: {!s}".format(config_file))
        return

    if action not in ['plot', 'netcdf']:
        logger.error("The 'action' paramter must be 'plot' or 'netcdf'")
        return

    mo = ModflowOutput(name_file, config_file=config_file)
    if action == "plot":
        mo.to_plot()
    else:
        action == "netcdf"
        mo.to_netcdf(output)

    return 0
コード例 #7
0
 def test_miami_dade_plot(self):
     working_dir = os.path.join(self.output_path, "miami-dade")
     miami_nam = os.path.join(working_dir, "UMD_fb.nam")
     miami_geo = os.path.join(working_dir, "miami-dade.geo")
     mf = ModflowOutput(miami_nam,
                        config_file=miami_geo,
                        exe_name="mf2005",
                        verbose=True,
                        model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='heads', colormap=matplotlib.cm.GnBu).show()
コード例 #8
0
 def test_carolina_plot(self):
     working_dir = os.path.join(self.output_path, "carolina")
     carolina_nam = os.path.join(working_dir, "1-23-07_NOASP.nam")
     carolina_geo = os.path.join(working_dir, "carolina.geo")
     mf = ModflowOutput(carolina_nam,
                        config_file=carolina_geo,
                        exe_name="mf2005",
                        verbose=True,
                        model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='heads', colormap=matplotlib.cm.GnBu).show()
コード例 #9
0
 def test_colorado_plot(self):
     working_dir = os.path.join(self.output_path, "colorado")
     colorado_nam = os.path.join(working_dir, "mod16_ssfix_wel2.nam")
     colorado_geo = os.path.join(working_dir, "colorado.geo")
     mf = ModflowOutput(colorado_nam,
                        config_file=colorado_geo,
                        exe_name="mf2005",
                        verbose=True,
                        model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='heads', level=4).show()
コード例 #10
0
 def test_freyberg_plot(self):
     working_dir = os.path.join(self.output_path, "freyberg")
     freyberg_nam = os.path.join(working_dir, "freyberg.nam")
     freyberg_geo = os.path.join(working_dir, "freyberg.geo")
     mf = ModflowOutput(freyberg_nam,
                        config_file=freyberg_geo,
                        exe_name="mf2005",
                        verbose=True,
                        model_ws=working_dir)
     assert mf is not None
     mf.to_plot(variable='flow_right_face_centered',
                colormap=matplotlib.cm.GnBu).show()
コード例 #11
0
def main(name_file, config_file, action, output=None, verbose=None):

    if verbose is True:
        logger.level = logging.DEBUG
    else:
        verbose = False
        logger.level = logging.INFO

    # Try to load files for immediate warnings back to the user
    try:
        with open(name_file) as f:
            f.read()
    except IOError:
        logger.info("Error opening namefile: {!s}".format(name_file))
        return

    try:
        with open(config_file) as f:
            f.read()
    except IOError:
        logger.info(
            "Error opening configuration file: {!s}".format(config_file))
        return

    if action not in ['plot', 'netcdf']:
        logger.error("The 'action' paramter must be 'plot' or 'netcdf'")
        return

    mo = ModflowOutput(name_file, config_file=config_file)
    if action == "plot":
        mo.to_plot()
    else:
        action == "netcdf"
        mo.to_netcdf(output)

    return 0
コード例 #12
0
 def test_plot(self):
     mf = ModflowOutput(self.resource, config_file=self.wgs84_config_file, exe_name="mf2005", verbose=True)
     assert mf is not None
     mf.to_plot().show()
コード例 #13
0
ax.set_title('Elevation')
ax.view_init(40, 210)

ax = fig.add_subplot(2, 2, 4, projection='3d')
p = ax.plot_surface(x, y, z, rstride=1, cstride=1, linewidth=0, cmap=cm.Spectral, alpha=0.80)
cb = fig.colorbar(p, shrink=0.7)
ax.set_xticks([])
ax.set_yticks([])
ax.set_title('Elevation')
ax.view_init(40, 300)


# In[9]:

# Helper plot methods
mf.to_plot(variable='heads', level=0, time=0)


# In[10]:

mf.to_plot(variable='flow_right_face_centered', level=0, time=0, colormap=cm.GnBu)


# In[2]:

import netCDF4
# Access existing model output over OPeNDAP
dap = netCDF4.Dataset("http://thredds45.pvd.axiomalaska.com/thredds/dodsC/grabbag/modflow2netcdf/colorado.nc")
# List variables
for varname in dap.variables:
    print varname