ccfx 0.1.0__tar.gz
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-0.1.0/LICENSE +21 -0
- ccfx-0.1.0/MANIFEST.in +2 -0
- ccfx-0.1.0/PKG-INFO +145 -0
- ccfx-0.1.0/README.md +121 -0
- ccfx-0.1.0/ccfx/__init__.py +5 -0
- ccfx-0.1.0/ccfx/ccfx.py +694 -0
- ccfx-0.1.0/ccfx/excel.py +143 -0
- ccfx-0.1.0/ccfx/mssqlConnection.py +228 -0
- ccfx-0.1.0/ccfx/sqliteConnection.py +302 -0
- ccfx-0.1.0/ccfx/word.py +96 -0
- ccfx-0.1.0/ccfx.egg-info/PKG-INFO +145 -0
- ccfx-0.1.0/ccfx.egg-info/SOURCES.txt +15 -0
- ccfx-0.1.0/ccfx.egg-info/dependency_links.txt +1 -0
- ccfx-0.1.0/ccfx.egg-info/requires.txt +10 -0
- ccfx-0.1.0/ccfx.egg-info/top_level.txt +1 -0
- ccfx-0.1.0/pyproject.toml +33 -0
- ccfx-0.1.0/setup.cfg +4 -0
ccfx-0.1.0/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Celray James CHAWANDA
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
ccfx-0.1.0/MANIFEST.in
ADDED
ccfx-0.1.0/PKG-INFO
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: ccfx
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Your package description here
|
5
|
+
Author-email: Celray James CHAWANDA <celray@chawanda.com>
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://github.com/celray/ccfx
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.9
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
License-File: LICENSE
|
14
|
+
Requires-Dist: netCDF4
|
15
|
+
Requires-Dist: gdal
|
16
|
+
Requires-Dist: numpy
|
17
|
+
Requires-Dist: shapely
|
18
|
+
Requires-Dist: geopandas
|
19
|
+
Requires-Dist: pandas
|
20
|
+
Requires-Dist: xlsxwriter
|
21
|
+
Requires-Dist: pyodbc
|
22
|
+
Requires-Dist: sqlalchemy
|
23
|
+
Requires-Dist: docx
|
24
|
+
|
25
|
+
# ccfx
|
26
|
+
|
27
|
+
`ccfx` is a comprehensive Python package designed to streamline file and data management, geospatial analysis, and NetCDF file processing for quick prototyping. The library provides versatile tools for file handling, raster and vector manipulation, database connectivity, and data export for geospatial and scientific computing projects.
|
28
|
+
|
29
|
+
## Features
|
30
|
+
|
31
|
+
1. **File Management**:
|
32
|
+
- List, delete, move, and count files within directories.
|
33
|
+
- Monitor file count over time in a specific directory.
|
34
|
+
- Save, load, and manage Python variables via pickle serialization.
|
35
|
+
|
36
|
+
2. **Geospatial Data Processing**:
|
37
|
+
- Read, write, and manage raster and vector geospatial data.
|
38
|
+
- Clip rasters by bounding boxes and extract raster values at specified coordinates.
|
39
|
+
- Create grids of polygons based on shapefile boundaries with user-defined resolutions.
|
40
|
+
- Convert coordinates between coordinate reference systems (CRS).
|
41
|
+
- Write NumPy arrays to GeoTIFF files with projection and geotransform settings.
|
42
|
+
|
43
|
+
3. **NetCDF File Handling**:
|
44
|
+
- List available variables and dimensions in NetCDF files.
|
45
|
+
- Export NetCDF variables to GeoTIFF format.
|
46
|
+
- Calculate sum and average maps from NetCDF data across multiple files.
|
47
|
+
|
48
|
+
4. **Database Connectivity**:
|
49
|
+
- Access and interact with databases using ODBC and SQLAlchemy for flexible database management.
|
50
|
+
- Connect to both SQL Server and SQLite databases.
|
51
|
+
|
52
|
+
5. **Progress Tracking and System Info**:
|
53
|
+
- Display dynamic progress bars for long-running operations.
|
54
|
+
- Check the system’s platform information.
|
55
|
+
- Enable or disable warnings programmatically.
|
56
|
+
|
57
|
+
6. **Excel and Word File Handling**:
|
58
|
+
- Create and modify Excel files using xlsxwriter.
|
59
|
+
- Generate Word documents with advanced formatting options using python-docx.
|
60
|
+
|
61
|
+
## Installation
|
62
|
+
|
63
|
+
Install `ccfx` via pip:
|
64
|
+
```bash
|
65
|
+
pip install ccfx
|
66
|
+
```
|
67
|
+
|
68
|
+
## Dependencies
|
69
|
+
|
70
|
+
`ccfx` relies on the following libraries:
|
71
|
+
|
72
|
+
- **netCDF4**: For working with NetCDF files.
|
73
|
+
- **gdal**: Required for geospatial raster data manipulation.
|
74
|
+
- **numpy**: For array processing and numerical operations.
|
75
|
+
- **pandas**: For data manipulation and analysis.
|
76
|
+
- **shapely**: Provides geometric operations for spatial data.
|
77
|
+
- **geopandas**: Extends pandas to handle geospatial data.
|
78
|
+
- **xlsxwriter**: For creating and writing Excel files.
|
79
|
+
- **pyodbc**: Enables connectivity to databases through ODBC.
|
80
|
+
- **sqlalchemy**: Provides SQL toolkit and ORM features for database access.
|
81
|
+
- **python-docx**: Enables creation and manipulation of Word documents.
|
82
|
+
|
83
|
+
These dependencies will be installed automatically when `ccfx` is installed.
|
84
|
+
|
85
|
+
## API Reference
|
86
|
+
|
87
|
+
### `listFiles(path: str, ext: str = None) -> list`
|
88
|
+
Lists all files in a directory with a specified extension.
|
89
|
+
|
90
|
+
- **Parameters**:
|
91
|
+
- `path` (str): The directory to search.
|
92
|
+
- `ext` (str, optional): File extension to filter by, e.g., `'txt'`, `'.txt'`, `'*txt'`, or `'*.txt'`.
|
93
|
+
|
94
|
+
- **Returns**:
|
95
|
+
- `list`: A list of file paths matching the criteria.
|
96
|
+
|
97
|
+
### `deleteFile(filePath: str, v: bool = False) -> bool`
|
98
|
+
Deletes a specified file with optional verbose output.
|
99
|
+
|
100
|
+
- **Parameters**:
|
101
|
+
- `filePath` (str): Path to the file to be deleted.
|
102
|
+
- `v` (bool, optional): If `True`, prints a confirmation message. Defaults to `False`.
|
103
|
+
|
104
|
+
- **Returns**:
|
105
|
+
- `bool`: `True` if deletion was successful; `False` otherwise.
|
106
|
+
|
107
|
+
### `createGrid(shapefile_path: str, resolution: float, useDegree: bool = True) -> tuple`
|
108
|
+
Generates a grid of polygons from a shapefile at a given resolution.
|
109
|
+
|
110
|
+
- **Parameters**:
|
111
|
+
- `shapefile_path` (str): Path to the shapefile.
|
112
|
+
- `resolution` (float): Resolution of the grid.
|
113
|
+
- `useDegree` (bool, optional): If `True`, coordinates are in degrees. Defaults to `True`.
|
114
|
+
|
115
|
+
- **Returns**:
|
116
|
+
- `tuple`: Contains grid coordinates and metadata.
|
117
|
+
|
118
|
+
### `clipRasterByExtent(inFile: str, outFile: str, bounds: tuple) -> str`
|
119
|
+
Clips a raster to specified bounding box coordinates.
|
120
|
+
|
121
|
+
- **Parameters**:
|
122
|
+
- `inFile` (str): Path to the input raster file.
|
123
|
+
- `outFile` (str): Path to the output clipped raster file.
|
124
|
+
- `bounds` (tuple): Bounding box as `(minx, miny, maxx, maxy)`.
|
125
|
+
|
126
|
+
- **Returns**:
|
127
|
+
- `str`: Path to the clipped raster file.
|
128
|
+
|
129
|
+
### `netcdfVariablesList(ncFile: str) -> list`
|
130
|
+
Lists all variables in a NetCDF file.
|
131
|
+
|
132
|
+
- **Parameters**:
|
133
|
+
- `ncFile` (str): Path to the NetCDF file.
|
134
|
+
|
135
|
+
- **Returns**:
|
136
|
+
- `list`: A list of variable names in the file.
|
137
|
+
|
138
|
+
### ... And More ...
|
139
|
+
|
140
|
+
## Contributing
|
141
|
+
|
142
|
+
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.
|
143
|
+
|
144
|
+
## License
|
145
|
+
This project is licensed under the MIT License.
|
ccfx-0.1.0/README.md
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# ccfx
|
2
|
+
|
3
|
+
`ccfx` is a comprehensive Python package designed to streamline file and data management, geospatial analysis, and NetCDF file processing for quick prototyping. The library provides versatile tools for file handling, raster and vector manipulation, database connectivity, and data export for geospatial and scientific computing projects.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
1. **File Management**:
|
8
|
+
- List, delete, move, and count files within directories.
|
9
|
+
- Monitor file count over time in a specific directory.
|
10
|
+
- Save, load, and manage Python variables via pickle serialization.
|
11
|
+
|
12
|
+
2. **Geospatial Data Processing**:
|
13
|
+
- Read, write, and manage raster and vector geospatial data.
|
14
|
+
- Clip rasters by bounding boxes and extract raster values at specified coordinates.
|
15
|
+
- Create grids of polygons based on shapefile boundaries with user-defined resolutions.
|
16
|
+
- Convert coordinates between coordinate reference systems (CRS).
|
17
|
+
- Write NumPy arrays to GeoTIFF files with projection and geotransform settings.
|
18
|
+
|
19
|
+
3. **NetCDF File Handling**:
|
20
|
+
- List available variables and dimensions in NetCDF files.
|
21
|
+
- Export NetCDF variables to GeoTIFF format.
|
22
|
+
- Calculate sum and average maps from NetCDF data across multiple files.
|
23
|
+
|
24
|
+
4. **Database Connectivity**:
|
25
|
+
- Access and interact with databases using ODBC and SQLAlchemy for flexible database management.
|
26
|
+
- Connect to both SQL Server and SQLite databases.
|
27
|
+
|
28
|
+
5. **Progress Tracking and System Info**:
|
29
|
+
- Display dynamic progress bars for long-running operations.
|
30
|
+
- Check the system’s platform information.
|
31
|
+
- Enable or disable warnings programmatically.
|
32
|
+
|
33
|
+
6. **Excel and Word File Handling**:
|
34
|
+
- Create and modify Excel files using xlsxwriter.
|
35
|
+
- Generate Word documents with advanced formatting options using python-docx.
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
|
39
|
+
Install `ccfx` via pip:
|
40
|
+
```bash
|
41
|
+
pip install ccfx
|
42
|
+
```
|
43
|
+
|
44
|
+
## Dependencies
|
45
|
+
|
46
|
+
`ccfx` relies on the following libraries:
|
47
|
+
|
48
|
+
- **netCDF4**: For working with NetCDF files.
|
49
|
+
- **gdal**: Required for geospatial raster data manipulation.
|
50
|
+
- **numpy**: For array processing and numerical operations.
|
51
|
+
- **pandas**: For data manipulation and analysis.
|
52
|
+
- **shapely**: Provides geometric operations for spatial data.
|
53
|
+
- **geopandas**: Extends pandas to handle geospatial data.
|
54
|
+
- **xlsxwriter**: For creating and writing Excel files.
|
55
|
+
- **pyodbc**: Enables connectivity to databases through ODBC.
|
56
|
+
- **sqlalchemy**: Provides SQL toolkit and ORM features for database access.
|
57
|
+
- **python-docx**: Enables creation and manipulation of Word documents.
|
58
|
+
|
59
|
+
These dependencies will be installed automatically when `ccfx` is installed.
|
60
|
+
|
61
|
+
## API Reference
|
62
|
+
|
63
|
+
### `listFiles(path: str, ext: str = None) -> list`
|
64
|
+
Lists all files in a directory with a specified extension.
|
65
|
+
|
66
|
+
- **Parameters**:
|
67
|
+
- `path` (str): The directory to search.
|
68
|
+
- `ext` (str, optional): File extension to filter by, e.g., `'txt'`, `'.txt'`, `'*txt'`, or `'*.txt'`.
|
69
|
+
|
70
|
+
- **Returns**:
|
71
|
+
- `list`: A list of file paths matching the criteria.
|
72
|
+
|
73
|
+
### `deleteFile(filePath: str, v: bool = False) -> bool`
|
74
|
+
Deletes a specified file with optional verbose output.
|
75
|
+
|
76
|
+
- **Parameters**:
|
77
|
+
- `filePath` (str): Path to the file to be deleted.
|
78
|
+
- `v` (bool, optional): If `True`, prints a confirmation message. Defaults to `False`.
|
79
|
+
|
80
|
+
- **Returns**:
|
81
|
+
- `bool`: `True` if deletion was successful; `False` otherwise.
|
82
|
+
|
83
|
+
### `createGrid(shapefile_path: str, resolution: float, useDegree: bool = True) -> tuple`
|
84
|
+
Generates a grid of polygons from a shapefile at a given resolution.
|
85
|
+
|
86
|
+
- **Parameters**:
|
87
|
+
- `shapefile_path` (str): Path to the shapefile.
|
88
|
+
- `resolution` (float): Resolution of the grid.
|
89
|
+
- `useDegree` (bool, optional): If `True`, coordinates are in degrees. Defaults to `True`.
|
90
|
+
|
91
|
+
- **Returns**:
|
92
|
+
- `tuple`: Contains grid coordinates and metadata.
|
93
|
+
|
94
|
+
### `clipRasterByExtent(inFile: str, outFile: str, bounds: tuple) -> str`
|
95
|
+
Clips a raster to specified bounding box coordinates.
|
96
|
+
|
97
|
+
- **Parameters**:
|
98
|
+
- `inFile` (str): Path to the input raster file.
|
99
|
+
- `outFile` (str): Path to the output clipped raster file.
|
100
|
+
- `bounds` (tuple): Bounding box as `(minx, miny, maxx, maxy)`.
|
101
|
+
|
102
|
+
- **Returns**:
|
103
|
+
- `str`: Path to the clipped raster file.
|
104
|
+
|
105
|
+
### `netcdfVariablesList(ncFile: str) -> list`
|
106
|
+
Lists all variables in a NetCDF file.
|
107
|
+
|
108
|
+
- **Parameters**:
|
109
|
+
- `ncFile` (str): Path to the NetCDF file.
|
110
|
+
|
111
|
+
- **Returns**:
|
112
|
+
- `list`: A list of variable names in the file.
|
113
|
+
|
114
|
+
### ... And More ...
|
115
|
+
|
116
|
+
## Contributing
|
117
|
+
|
118
|
+
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.
|
119
|
+
|
120
|
+
## License
|
121
|
+
This project is licensed under the MIT License.
|