Skip to content

Commit

Permalink
update files
Browse files Browse the repository at this point in the history
  • Loading branch information
dghorai committed Mar 22, 2024
1 parent e0ac7c1 commit c00e78f
Show file tree
Hide file tree
Showing 95 changed files with 1,140 additions and 1,035 deletions.
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,8 @@ dmypy.json
# others
.idea
logs/*
src/__pycache__
src/raster/__pycache__
src/raster/components/__pycache__
src/raster/pipeline/__pycache__
src/vector/__pycache__
src/vector/components/__pycache__
src/vector/pipeline/__pycache__
test/__pycache__
geobhumi/__pycache__
geobhumi/geo_app/__pycache__
geobhumi/raster_ops/__pycache__
geobhumi/vector_ops/__pycache__
tests/__pycache__
56 changes: 52 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,55 @@
# rsgis-toolbox
# geo-bhumi

Geospatial utilities for Remote Sensing and GIS application.

# Description
Geospatial Utilities for Remote Sensing and GIS Application.

This repository has several scripts written in Python for Remote Sensing and GIS data analysis and workflow automation. This is an early development toolset, and is suitable for geospatial data analysis. Features and implementation are subject to change.

# Introduction

The `geo-bhumi` Python package aims to simplify geospatial tasks and automate geospatial application development. This library provides a comprehensive set of tools for Remote Sensing and GIS. By addressing the gaps in geospatial data processing tools and offering automation capabilities, this package proves to be an essential resource. Many of the tools are derived from scientific research articles, while others consist of efficient algorithms that enable streamlined processing with minimal code. With these tools, users or researchers can focus on analyzing their application results rather than spending time on coding or starting from scratch.

# Features

### Raster Functionalities

| Functions or Classes | Descriptions |
| :------------------------------------- | :---------------------------------------------- |
| clip_raster_by_extent() | Clip Raster by Extent |
| raster_to_point() | Convert Rater Pixel to Point Shapefile |
| dn_to_radiance() | Convert Pixel DN Values to Radiance |
| extract_lulc_class() | Export Individual LULC Class |
| get_border_pixel_values() | Extract Border Pixel Values |
| group_raster_pixels() | Group Homogeneous Pixel Values |
| find_sinknflat_dem() | Identify Sink/Flat Pixels in DEM |
| radiance2degree_celsious_temperature() | Convert Radiance to Degree-Celsious Temperature |
| regular_shift_raster() | Shift Raster in Different Direction |
| mosaic_raster() | Mosaic GeoTIFF Tiles |

### Vector Functionalities

| Functions or Classes | Descriptions |
| :----------------------------- | :------------------------------------------------- |
| get_cumulative_drainage_area() | Calculate Cumulative Drainage Area |
| generate_river_xscl() | Create Cross-Section Line of River |
| generate_grid_boundary() | Generate Grid Boundary from Point |
| get_nearest_point() | Find Closest Point |
| LineDirectionError() | Check River Network's Line Direction |
| GenerateHydroID() | Generate HydroID of River Network |
| CreateGroupID() | Generate GroupID of River Network |
| CreateObjectID() | Generate ObjectID of River Network |
| FnTnodeID() | Generate From-Node and To-Node ID of River Network |
| wkt_to_gdf() | Convert WKT to Geo-DataFrame |
| extract_overlap_polygon() | Extract Overlap Polygon Geometry |
| merge_shapefiles() | Merge Vector Files |

### Tools for Application

| Functions or Classes | Descriptions |
| :-------------------------- | :------------------- |
| generate_shoreline_raster() | Shoreline Extraction |

# Installation

pip install git+https://github.com/dghorai/geo-bhumi

# Acknowledgment
67 changes: 0 additions & 67 deletions consts.py

This file was deleted.

19 changes: 0 additions & 19 deletions exception.py

This file was deleted.

53 changes: 53 additions & 0 deletions geobhumi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""
Top-level package for geo-bhumi.
"""

__version__ = '0.0.3'
__author__ = 'Dr. Debabrata Ghorai'
__email__ = '[email protected]'

import os
import sys
import logging
import datetime


class CustomException(Exception):

def __init__(self, err, sys_err: sys):
super().__init__(err)
self.err_msg = error_handling(err, sys_err=sys_err)

def __str__(self):
return self.err_msg


def error_handling(err, sys_err: sys):
# using the sys module to access more of the exception's information with sys.exc_info
_, _, exp_trace_back = sys_err.exc_info()
file_name = exp_trace_back.tb_frame.f_code.co_filename
err_msg = f"Error occured in python script name [{file_name}] line number [{exp_trace_back.tb_lineno}] error message [{str(err)}]"
return err_msg


# create log folder and file
project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
log_dir = os.path.join(project_dir, "logs")
log_file_name = f"{datetime.datetime.now().strftime('%m_%d_%Y_%H_%M_%S')}.log"
log_file = os.path.join(log_dir, log_file_name)
os.makedirs(log_dir, exist_ok=True)

# setup logging
logging_str = "[%(asctime)s: %(levelname)s: %(module)s]: %(message)s"

# add basic config
logging.basicConfig(
level=logging.INFO,
format=logging_str,
handlers=[
logging.FileHandler(log_file),
logging.StreamHandler(sys.stdout)
]
)

logger = logging.getLogger("GeoBhumiLogger")
17 changes: 17 additions & 0 deletions src/vector_ops/config_entity.py → geobhumi/config_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,20 @@ class VectordataConfig:
vector_outfile: Path
vector_file_dir: Path
vector_geometry_type: str


@dataclass(frozen=True)
class RasterdataConfig:
raster_infile: Path
polygon_infile: Path
clip_raster_file: Path
out_point_file: Path
output_folder: Path
lmax_list: list
lmin_list: list
qcal_min: float
qcal_max: float
prefix: str
lulc_raster_file: Path
lulc_out_raster_file: Path
lilc_class_code: int
File renamed without changes.
Loading

0 comments on commit c00e78f

Please sign in to comment.