def test_wkt_parse(): """Test parsing of Coordinate Reference System parameters from well-known-text in .prj files.""" from flopy.utils.reference import crs prjs = glob.glob('../examples/data/prj_test/*') for prj in prjs: with open(prj) as src: wkttxt = src.read() wkttxt = wkttxt.replace("'", '"') if len(wkttxt) > 0 and 'projcs' in wkttxt.lower(): crsobj = crs(esri_wkt=wkttxt) geocs_params = [ 'wktstr', 'geogcs', 'datum', 'spheroid_name', 'semi_major_axis', 'inverse_flattening', 'primem', 'gcs_unit' ] for k in geocs_params: assert crsobj.__dict__[k] is not None projcs_params = [ k for k in crsobj.__dict__ if k not in geocs_params ] if crsobj.projcs is not None: for k in projcs_params: if k in wkttxt.lower(): assert crsobj.__dict__[k] is not None
def test_wkt_parse(): """Test parsing of Coordinate Reference System parameters from well-known-text in .prj files.""" from flopy.utils.reference import crs prjs = glob.glob('../examples/data/prj_test/*') for prj in prjs: with open(prj) as src: wkttxt = src.read() wkttxt = wkttxt.replace("'", '"') if len(wkttxt) > 0 and 'projcs' in wkttxt.lower(): crsobj = crs(esri_wkt=wkttxt) geocs_params = ['wktstr', 'geogcs', 'datum', 'spheriod_name', 'semi_major_axis', 'inverse_flattening', 'primem', 'gcs_unit'] for k in geocs_params: assert crsobj.__dict__[k] is not None projcs_params = [k for k in crsobj.__dict__ if k not in geocs_params] if crsobj.projcs is not None: for k in projcs_params: if k in wkttxt.lower(): assert crsobj.__dict__[k] is not None