@@ -284,7 +284,7 @@ def __emptyframe():
284
284
#
285
285
# __todataframe
286
286
#
287
- def __todataframe (columns , delta_time_key = "delta_time" , lon_key = "lon" , lat_ley = "lat" ):
287
+ def __todataframe (columns , delta_time_key = "delta_time" , lon_key = "lon" , lat_key = "lat" , index_key = "time " ):
288
288
289
289
# Check Empty Columns
290
290
if len (columns ) <= 0 :
@@ -296,12 +296,21 @@ def __todataframe(columns, delta_time_key="delta_time", lon_key="lon", lat_ley="
296
296
columns ['time' ] = geopandas .pd .to_datetime (atlas_sdp_epoch + delta_time )
297
297
298
298
# Generate Geometry Column
299
- geometry = geopandas .points_from_xy (columns [lon_key ], columns [lat_ley ])
299
+ geometry = geopandas .points_from_xy (columns [lon_key ], columns [lat_key ])
300
300
del columns [lon_key ]
301
- del columns [lat_ley ]
301
+ del columns [lat_key ]
302
302
303
- # Build and Return GeoDataFrame (default geometry is crs="EPSG:4326")
303
+ # Create Pandas DataFrame object
304
304
df = geopandas .pd .DataFrame (columns )
305
+
306
+ # Set index (default is Timestamp), can add `verify_integrity=True` to check for duplicates
307
+ # Can do this during DataFrame creation, but this allows input argument for desired column
308
+ df .set_index (index_key , inplace = True )
309
+
310
+ # Sort values for reproducible output despite async processing
311
+ df .sort_index (inplace = True )
312
+
313
+ # Build and Return GeoDataFrame (default geometry is crs="EPSG:4326")
305
314
gdf = geopandas .GeoDataFrame (df , geometry = geometry )
306
315
return gdf
307
316
0 commit comments