Please consider responding to a brief user needs survey.

Add add_latlon() to extractor, remove argument from prep_points function definition.

parent 59bca6b7
......@@ -201,7 +201,7 @@ def calc_pt_distances(df):
df = join_columns(df, df2)
return(df)
def prep_points(df, tID_fld, pID_fld, MHW, fill=-99999, old2newflds={}):
def prep_points(df, tID_fld, pID_fld, MHW=None, fill=-99999, old2newflds={}):
"""Preprocess transect points (after running FCtoDF(transPts, xy=True))"""
# Replace fills with NaNs
df.replace(fill, np.nan, inplace=True)
......
......@@ -847,6 +847,9 @@
" sorted_pt_flds[i] = c\n",
"pts_df = pts_df.reindex_axis(sorted_pt_flds, axis=1)\n",
"\n",
"# convert projected coordinates to geographic coordinates (lat, lon in NAD83)\n",
"pts_df = fun.add_latlon(pts_df, proj_code)\n",
"\n",
"# Save dataframes \n",
"trans_df.to_pickle(os.path.join(scratch_dir, trans_name+'_null.pkl'))\n",
"pts_df.to_pickle(os.path.join(scratch_dir, pts_name+'_null.pkl'))\n",
......@@ -855,30 +858,6 @@
"pts_df.sample(5)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Use pyproj to convert projected coordinates to geographic coordinates (lat, lon in NAD83)\n",
"utm = pyproj.Proj(init='epsg:{}'.format(proj_code))\n",
"nad = pyproj.Proj(init='epsg:4269') # NAD83\n",
"\n",
"in_y = pts_df['seg_y'].tolist()\n",
"in_x = pts_df['seg_x'].tolist()\n",
"\n",
"lon, lat = pyproj.transform(utm, nad, in_x,in_y)\n",
"\n",
"lon_col = 'seg_lon'\n",
"lat_col = 'seg_lat'\n",
"\n",
"pts_df[lon_col] = lon\n",
"pts_df[lat_col] = lat"
]
},
{
"cell_type": "markdown",
"metadata": {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment