Skip to content

Commit

Permalink
refactor(utils/mfreadnam.py): write crs 'srs' attribute string to nam…
Browse files Browse the repository at this point in the history
…efile header under 'crs' key; read 'proj4' key as crs input
  • Loading branch information
aleaf committed Feb 22, 2023
1 parent 9545739 commit a792e73
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion flopy/utils/mfreadnam.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def attribs_from_namfile_header(namefile):
"xul": None,
"yul": None,
"rotation": 0.0,
"crs": None,
"proj4_str": None,
}
if namefile is None:
Expand Down Expand Up @@ -259,7 +260,15 @@ def attribs_from_namfile_header(namefile):
proj4 = ":".join(item.split(":")[1:]).strip()
if proj4.lower() == "none":
proj4 = None
defaults["proj4_str"] = proj4
defaults["crs"] = proj4
except:
print(f" could not parse proj4_str in {namefile}")
elif "crs" in item.lower():
try:
crs = ":".join(item.split(":")[1:]).strip()
if crs.lower() == "none":
proj4 = None
defaults["crs"] = crs
except:
print(f" could not parse proj4_str in {namefile}")
elif "start" in item.lower():
Expand Down

0 comments on commit a792e73

Please sign in to comment.