ccfx 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ccfx/ccfx.py CHANGED
@@ -258,7 +258,7 @@ def downloadChunk(url, start, end, path):
258
258
  if chunk:
259
259
  f.write(chunk)
260
260
 
261
- def downloadFile(url, save_path, exists_action='resume', num_connections=7, v=True):
261
+ def downloadFile(url, save_path, exists_action='resume', num_connections=5, v=True):
262
262
  if v:
263
263
  print(f"\ndownloading {url}")
264
264
  fname = getFileBaseName(url, extension=True)
@@ -1193,6 +1193,29 @@ def listAllFiles(folder, extension="*"):
1193
1193
  return list_of_files
1194
1194
 
1195
1195
 
1196
+ def clipFeatures(inputFeaturePath:str, boundaryFeature:str, outputFeature:str, keepOnlyTypes = None, v = False) -> geopandas.GeoDataFrame:
1197
+ '''
1198
+ keepOnlyTypes = ['MultiPolygon', 'Polygon', 'Point', etc]
1199
+
1200
+ '''
1201
+ mask_gdf = geopandas.read_file(boundaryFeature)
1202
+ input_gdf = geopandas.read_file(inputFeaturePath)
1203
+
1204
+ outDir = os.path.dirname(outputFeature)
1205
+ createPath(f"{outDir}/")
1206
+ out_gdf = input_gdf.clip(mask_gdf.to_crs(input_gdf.crs))
1207
+
1208
+ if not keepOnlyTypes is None:
1209
+ out_gdf = out_gdf[out_gdf.geometry.apply(lambda x : x.type in keepOnlyTypes)]
1210
+
1211
+ out_gdf.to_file(outputFeature)
1212
+
1213
+ if v:
1214
+ print("\t - clipped feature to " + outputFeature)
1215
+ return out_gdf
1216
+
1217
+
1218
+
1196
1219
  def createPointGeometry(coords: list, proj: str = "EPSG:4326") -> geopandas.GeoDataFrame:
1197
1220
  '''
1198
1221
  Convert list of coordinate tuples to GeoDataFrame
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ccfx
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: This package simplifies regular common actions for quick prototyping in a user friendly way
5
5
  Author-email: Celray James CHAWANDA <celray@chawanda.com>
6
6
  License: MIT
@@ -1,11 +1,11 @@
1
1
  ccfx/__init__.py,sha256=VmBeF3oj6JTJ_793d4i8PvhyF8_FxaxA1L_FmHWqitc,142
2
- ccfx/ccfx.py,sha256=05Xcv_RtPoQLVJdsdG2GO7ra_8ANTRf05dhTFHIA9RM,54836
2
+ ccfx/ccfx.py,sha256=4BD22BQovfkcAFZRkoHaA1quvXlDBFc1GiH_Fffz6Q8,55571
3
3
  ccfx/excel.py,sha256=cQ4TQW49XqbMB3sSS0IOhO3-WArIolEBIrvOvhFyPtI,4757
4
4
  ccfx/mssqlConnection.py,sha256=TwyZXhHHI7zy6BSfH1pszuHVJ5cmndRC5dVxvEtSTks,7904
5
5
  ccfx/sqliteConnection.py,sha256=jEJ94D5ySt84N7AeDpa27Rclt1NaKhkX6nYzidwApIg,11104
6
6
  ccfx/word.py,sha256=AGa64jX5Zl5qotZh5L0QmrsjTnktIBhmj_ByRKZ88vw,3061
7
- ccfx-0.6.0.dist-info/licenses/LICENSE,sha256=2-M3fBUS3FmrSIrqd3cZDmxXxojWVJtZY-SHSRE6RxM,1098
8
- ccfx-0.6.0.dist-info/METADATA,sha256=OmS1T49N5s5qhS4B17LntNzA2qHxZV1BnELdB0n5PQM,5425
9
- ccfx-0.6.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
10
- ccfx-0.6.0.dist-info/top_level.txt,sha256=_cSvSA1WX2K8TgoV3iBJUdUZZqMKJbOPLNnKLYSLHaw,5
11
- ccfx-0.6.0.dist-info/RECORD,,
7
+ ccfx-0.7.0.dist-info/licenses/LICENSE,sha256=2-M3fBUS3FmrSIrqd3cZDmxXxojWVJtZY-SHSRE6RxM,1098
8
+ ccfx-0.7.0.dist-info/METADATA,sha256=_rPWPy0bHKGdUv5y2Ovt_XGpIbRv7Xa33oJJDfWDv-o,5425
9
+ ccfx-0.7.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
10
+ ccfx-0.7.0.dist-info/top_level.txt,sha256=_cSvSA1WX2K8TgoV3iBJUdUZZqMKJbOPLNnKLYSLHaw,5
11
+ ccfx-0.7.0.dist-info/RECORD,,
File without changes