I've used Flopy to generate a shapefile of polygon features representing MODFLOW River Package features. However, the size of the grid cell polygon features in the shapefile are 3.28 times larger than they should be. The length units of my model are in feet (the LENUNI variable in the MODFLOW Discretization Package of my model is equal to 1), and I'm using NAD83 / UTM Zone 16N (length unit is meters, EPSG:26916). Therefore, it looks like the conversion between MODFLOW model units (in feet) and GIS coordinate reference system (in meters) isn't happening for some reason.
The grid origin and rotation in the Flopy-generated shapefile look okay. Here is the Flopy code used to generate the shapefile:
model_ws = os.getcwd()
m = flopy.modflow.Modflow.load("model.nam", model_ws=model_ws, verbose=False,
check=False, exe_name="MODFLOW-NWT_64.exe")
grid = m.modelgrid
delr = grid.delr
delc = grid.delc
xll = 660768.2212
yll = 3282397.889
rot = -16.92485016
model_epsg = 26916
m.modelgrid.set_coord_info(xoff=xll, yoff=yll, angrot=rot, epsg='EPSG:26916')
m.riv.stress_period_data.export('{0}/riv_features.shp'.format(model_ws), sparse=True)
When the last line of code is executed, the shapefile is written to disk, but the following error messages precede the message confirming that the shapefile was output:
(<class 'urllib.error.HTTPError'>, <HTTPError 404: 'NOT FOUND'>, <traceback object at 0x11646208>)
No internet connection or epsg code EPSG:26916 not found at https://spatialreference.org/ref/epsg/EPSG:26916/esriwkt
No internet connection or epsg code EPSG:26916 not found at https://spatialreference.org/ref/esri/EPSG:26916/esriwkt
The URL associated with the above error messages is https://spatialreference.org/ref/epsg/EPSG:26916/esriwkt. This URL displayed the following:
Not found, /ref/epsg/EPSG:26916/esriwkt.
So could the problem be that Flopy is not getting the information that it needs from spatialreference.org? If so, is the URL that Flopy is generating incorrect? Is there something in my code that is incorrect?
Thanks very much.