Giter VIP home page Giter VIP logo

quadrantic's Introduction

quadrantic

Determination of quadrants based on angle, coordinates and others

https://pepy.tech/badge/quadrantic/month https://img.shields.io/github/license/earthobservations/quadrantic

Overview

This library allows you to determine quadrant(s) based on

  • angle (360° or 400 Gon)
  • location (latlon)

Setup

Via Pip:

pip install quadrantic

Via Github (latest):

pip install git+https://github.com/earthobservations/quadrantic

Implementations

Get quadrant for angle

Determine quadrant based on

Degree

#####################
#         # 90°     #
#         #         #
# 180°    #      0° #
#####################
#         #         #
#         #         #
#         # 270°    #
#####################

or

Gon

#####################
#         # 100°    #
#         #         #
# 200°    #      0° #
#####################
#         #         #
#         #         #
#         # 300°    #
#####################
from quadrantic import QuadrantFromAngle, AngleUnit, Q

quad = QuadrantFromAngle() # no args need for this method

# Single quadrant
quad.get(45.0, AngleUnit.DEGREE)
# [Q.FIRST]

# Two quadrants
quad.get(90.0, AngleUnit.DEGREE)
# [Q.FIRST, Q.SECOND]

# More then full circle (360°)
quad.get(450.0, AngleUnit.DEGREE) # same as above + 360°
# [Q.FIRST, Q.SECOND]

# Negative degree
quad.get(-45.0, AngleUnit.DEGREE)
# [Q.FOURTH]

# Degree in Gon
quad.get(90.0, AngleUnit.GON)
# [Q.FIRST]

Get quadrant for coordinates

#####################
# (-1,1)  #   (1,1) #
#         #         #
#         # (0,0)   #
#####################
#         #         #
#         #         #
#         #         #
#####################
from quadrantic import QuadrantFromCoords, AngleUnit, Q
from shapely.geometry import Point

# Single quadrant
quad = QuadrantFromCoords((0.0, 0.0))
quad.get((1.0, 1.0))
# [Q.FIRST]

# Two quadrants
quad = QuadrantFromCoords((0.0, 0.0))
quad.get((0.0, 1.0))
# [Q.FIRST, Q.SECOND]

# All quadrants
quad = QuadrantFromCoords((0.0, 0.0))
quad.get((0.0, 0.0))
# [Q.FIRST, Q.SECOND, Q.THIRD, Q.FOURTH]

# Single quadrant with shapely Point
quad = QuadrantFromCoords(Point(0.0, 0.0))
quad.get(Point(1.0, 1.0))
# [Q.FIRST]

Examples

Visualized examples can be found in the examples folder.

License

Distributed under the MIT License. See LICENSE.rst for more info.

Changelog

Development

0.1.0 (25.09.2022)

  • Add first version of quadrantic

quadrantic's People

Contributors

gutzbenj avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.