How to use the timezonefinder.TimezoneFinder function in timezonefinder

To help you get started, we’ve selected a few timezonefinder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleCloudPlatform / data-science-on-gcp / 04_streaming / simulate / df03.py View on Github external
def addtimezone(lat, lon):
   try:
      import timezonefinder
      tf = timezonefinder.TimezoneFinder()
      return (lat, lon, tf.timezone_at(lng=float(lon), lat=float(lat)))
      #return (lat, lon, 'America/Los_Angeles') # FIXME
   except ValueError:
      return (lat, lon, 'TIMEZONE') # header
github GoogleCloudPlatform / data-science-on-gcp / 04_streaming / simulate / df06.py View on Github external
def addtimezone(lat, lon):
   try:
      import timezonefinder
      tf = timezonefinder.TimezoneFinder()
      return (lat, lon, tf.timezone_at(lng=float(lon), lat=float(lat)))
      #return (lat, lon, 'America/Los_Angeles') # FIXME
   except ValueError:
      return (lat, lon, 'TIMEZONE') # header
github mikelambert / dancedeets-monorepo / server / dancedeets / events / event_updates.py View on Github external
from dancedeets.search import search
from dancedeets.nlp import categories
from dancedeets.nlp import event_classifier
from dancedeets.util import dates
from dancedeets.util import fb_events
from dancedeets.util import language
from dancedeets.util import timelog
from . import event_image
from . import event_locations
from . import namespaces
from . import web_events_reloading

DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%S"
DATETIME_FORMAT_TZ = "%Y-%m-%dT%H:%M:%S%z"

timezone_finder = TimezoneFinder()

reload_functions = {
    namespaces.CHINA_JWJAM_JAM: web_events_reloading.fetch_jwjam_jam,
    namespaces.CHINA_JWJAM_COURSE: web_events_reloading.fetch_jwjam_course,
}


def reload_web_events(web_events, disable_updates=None):
    events_to_update = []
    for web_event in web_events:
        if web_event.namespace in reload_functions:
            func = reload_functions[web_event.namespace]
            new_json = func(web_event)
            events_to_update.append((web_event, new_json))
        else:
            events_to_update.append((web_event, web_event.web_event))
github burakbayramli / kod / nomadicterrain / ui / main.py View on Github external
calprev = str(calendar.month(prev.year, prev.month))
    calnext = str(calendar.month(next.year, next.month))    
    
    times = {}
    fmt = '%Y-%m-%d %H:%M'
    now_utc = datetime.datetime.now(timezone('UTC'))

    now_ny = now_utc.astimezone(timezone('US/Eastern'))
    times['ny'] = now_ny.strftime(fmt)

    times['utc'] = now_utc.strftime(fmt)

    now_tr = now_utc.astimezone(timezone('Turkey'))
    times['tr'] = now_tr.strftime(fmt)

    tf = timezonefinder.TimezoneFinder()
    timezone_str = tf.certain_timezone_at(lat=lat, lng=lon)
    now_curr = now_utc.astimezone(timezone(timezone_str))
    times['curr'] = now_curr.strftime(fmt)

    weekday = list(calendar.day_name)[now_utc.weekday()]
    
    return render_template('/time.html',
                           calprev=calprev,
                           calcurr=calcurr,
                           calnext=calnext,
                           times=times,
                           weekday=weekday,
                           tzone=timezone_str)
github GoogleCloudPlatform / data-science-on-gcp / 04_streaming / simulate / df04.py View on Github external
def addtimezone(lat, lon):
   try:
      import timezonefinder
      tf = timezonefinder.TimezoneFinder()
      return (lat, lon, tf.timezone_at(lng=float(lon), lat=float(lat)))
      #return (lat, lon, 'America/Los_Angeles') # FIXME
   except ValueError:
      return (lat, lon, 'TIMEZONE') # header
github GoogleCloudPlatform / data-science-on-gcp / 04_streaming / simulate / df05.py View on Github external
def addtimezone(lat, lon):
   try:
      import timezonefinder
      tf = timezonefinder.TimezoneFinder()
      return (lat, lon, tf.timezone_at(lng=float(lon), lat=float(lat)))
      #return (lat, lon, 'America/Los_Angeles') # FIXME
   except ValueError:
      return (lat, lon, 'TIMEZONE') # header
github MrMinimal64 / timezonefinder / example.py View on Github external
from timezonefinder import TimezoneFinder

TimezoneFinder.using_numba()  # this is a static method returning True or False

tf = TimezoneFinder()
# or
tf = TimezoneFinder(in_memory=True)

longitude, latitude = 13.358, 52.5061
tf.timezone_at(lng=longitude, lat=latitude)  # returns 'Europe/Berlin'
tf.certain_timezone_at(lng=longitude, lat=latitude)  # returns 'Europe/Berlin'

longitude = 12.773955
latitude = 55.578595
tf.closest_timezone_at(lng=longitude, lat=latitude)  # returns 'Europe/Copenhagen'

longitude = 42.1052479
latitude = -16.622686
tf.closest_timezone_at(lng=longitude, lat=latitude, delta_degree=2, exact_computation=True, return_distances=True,
github GoogleCloudPlatform / data-science-on-gcp / 04_streaming / simulate / df02.py View on Github external
def addtimezone(lat, lon):
   try:
      import timezonefinder
      tf = timezonefinder.TimezoneFinder()
      tz = tf.timezone_at(lng=float(lon), lat=float(lat))
      if tz is None:
         tz = 'UTC'
      return (lat, lon, tz)
   except ValueError:
      return (lat, lon, 'TIMEZONE') # header
github MrMinimal64 / timezonefinder / example.py View on Github external
from timezonefinder import TimezoneFinder

TimezoneFinder.using_numba()  # this is a static method returning True or False

tf = TimezoneFinder()
# or
tf = TimezoneFinder(in_memory=True)

longitude, latitude = 13.358, 52.5061
tf.timezone_at(lng=longitude, lat=latitude)  # returns 'Europe/Berlin'
tf.certain_timezone_at(lng=longitude, lat=latitude)  # returns 'Europe/Berlin'

longitude = 12.773955
latitude = 55.578595
tf.closest_timezone_at(lng=longitude, lat=latitude)  # returns 'Europe/Copenhagen'

longitude = 42.1052479
latitude = -16.622686
tf.closest_timezone_at(lng=longitude, lat=latitude, delta_degree=2, exact_computation=True, return_distances=True,
                       force_evaluation=True)