Your package description here
Project description
ccfx
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.
Features
-
File Management:
- List, delete, move, and count files within directories.
- Monitor file count over time in a specific directory.
- Save, load, and manage Python variables via pickle serialization.
-
Geospatial Data Processing:
- Read, write, and manage raster and vector geospatial data.
- Clip rasters by bounding boxes and extract raster values at specified coordinates.
- Create grids of polygons based on shapefile boundaries with user-defined resolutions.
- Convert coordinates between coordinate reference systems (CRS).
- Write NumPy arrays to GeoTIFF files with projection and geotransform settings.
-
NetCDF File Handling:
- List available variables and dimensions in NetCDF files.
- Export NetCDF variables to GeoTIFF format.
- Calculate sum and average maps from NetCDF data across multiple files.
-
Database Connectivity:
- Access and interact with databases using ODBC and SQLAlchemy for flexible database management.
- Connect to both SQL Server and SQLite databases.
-
Progress Tracking and System Info:
- Display dynamic progress bars for long-running operations.
- Check the system’s platform information.
- Enable or disable warnings programmatically.
-
Excel and Word File Handling:
- Create and modify Excel files using xlsxwriter.
- Generate Word documents with advanced formatting options using python-docx.
Installation
Install ccfx
via pip:
pip install ccfx
Dependencies
ccfx
relies on the following libraries:
- netCDF4: For working with NetCDF files.
- gdal: Required for geospatial raster data manipulation.
- numpy: For array processing and numerical operations.
- pandas: For data manipulation and analysis.
- shapely: Provides geometric operations for spatial data.
- geopandas: Extends pandas to handle geospatial data.
- xlsxwriter: For creating and writing Excel files.
- pyodbc: Enables connectivity to databases through ODBC.
- sqlalchemy: Provides SQL toolkit and ORM features for database access.
- python-docx: Enables creation and manipulation of Word documents.
These dependencies will be installed automatically when ccfx
is installed.
API Reference
listFiles(path: str, ext: str = None) -> list
Lists all files in a directory with a specified extension.
-
Parameters:
path
(str): The directory to search.ext
(str, optional): File extension to filter by, e.g.,'txt'
,'.txt'
,'*txt'
, or'*.txt'
.
-
Returns:
list
: A list of file paths matching the criteria.
deleteFile(filePath: str, v: bool = False) -> bool
Deletes a specified file with optional verbose output.
-
Parameters:
filePath
(str): Path to the file to be deleted.v
(bool, optional): IfTrue
, prints a confirmation message. Defaults toFalse
.
-
Returns:
bool
:True
if deletion was successful;False
otherwise.
createGrid(shapefile_path: str, resolution: float, useDegree: bool = True) -> tuple
Generates a grid of polygons from a shapefile at a given resolution.
-
Parameters:
shapefile_path
(str): Path to the shapefile.resolution
(float): Resolution of the grid.useDegree
(bool, optional): IfTrue
, coordinates are in degrees. Defaults toTrue
.
-
Returns:
tuple
: Contains grid coordinates and metadata.
clipRasterByExtent(inFile: str, outFile: str, bounds: tuple) -> str
Clips a raster to specified bounding box coordinates.
-
Parameters:
inFile
(str): Path to the input raster file.outFile
(str): Path to the output clipped raster file.bounds
(tuple): Bounding box as(minx, miny, maxx, maxy)
.
-
Returns:
str
: Path to the clipped raster file.
netcdfVariablesList(ncFile: str) -> list
Lists all variables in a NetCDF file.
-
Parameters:
ncFile
(str): Path to the NetCDF file.
-
Returns:
list
: A list of variable names in the file.
... And More ...
Contributing
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ccfx-0.2.0.tar.gz
.
File metadata
- Download URL: ccfx-0.2.0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 452ff693424d4c99746ff3f4963eab590b7e2c254c4aaa6499e0b209e64e8132 |
|
MD5 | c7717698ceb7919c266ce8a63104e72f |
|
BLAKE2b-256 | 0fcce4fbc4c56edc878989e0cb3f1cfe41c3708c17ee0332494119c673721df7 |
File details
Details for the file ccfx-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: ccfx-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d946fb0bde1f49d0eed43046fb41f762dc9dd88b361cbe61e980f3f92b7d91cc |
|
MD5 | a4ee9d6a520d864a55828da028a57fca |
|
BLAKE2b-256 | 2db1632bc4f78d05ac81fa040e9236fd8330fba9d05b1329d994249ed869c20c |