Skip to main content

Pypi Pypi Build Status PyPI - Downloads codecov

EorzeaEnv

Installation

pip install eorzeaenv

Usage

from EorzeaEnv import EorzeaLang, EorzeaTime, EorzeaWeather, EorzeaPlaceName

Eorzea Language enum

support_langs = [
    EorzeaLang.EN,
    EorzeaLang.JA,
    EorzeaLang.DE,
    EorzeaLang.FR,
    EorzeaLang.ZH_SC,
    EorzeaLang.KO,
]

Eorzea Time

>>> EorzeaTime.now()
'EorzeaTime(Sixth Embral Moon, 11, 21, 56, Phase:0.50, Althyk)'

>>> EorzeaTime.now().moon
'Sixth Embral Moon'

>>> EorzeaTime.now().sun
11

>>> EorzeaTime.now().hour
21

>>> EorzeaTime.now().minute
56

>>> EorzeaTime.now().phase
0.50

>>> EorzeaTime.now().guardian
'Althyk'
  • Get the unix timestamp (int not float)
>>> EorzeaTime.now().get_unix_time()
1661114514
  • Get the eorzea timestamp (int not float)
>>> EorzeaTime.now().get_eorzea_time()
34177649220

Weather Forecast

  • Using period as tuple or list
# defalut step value is 5
# This method return a generator if you need to re-use it save the values as `tuple` or `list`.
t = tuple(EorzeaTime.weather_period(step=3))

# Use EorzeaPlaceName to ensure the place is valid or
# you can directly pass the place string to forecast.
place_name = EorzeaPlaceName('Eureka Pyros')

# Defalut lang is 'en'
# Defalut strict is `True` for strict mode `False` for fuzzy mode.
# eg. `eurekaa puros` is valid in fuzzy mode.

# In fuzzy mode, you can set the cutoff score to prevent unexpected place name to be passed.
# default value is 80. (100 >= value >= 0)
EorzeaWeather.set_fuzzy_cutoff(95)

weather_en = EorzeaWeather.forecast(place_name, t, strict=True)
weather_ja = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.JA, strict=True)
weather_de = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.DE, strict=True)
weather_fr = EorzeaWeather.forecast(place_name, t, lang=EorzeaLang.FR, strict=True)
>>> print(weather_en)
['Thunder', 'Snow', 'Blizzards']

>>> print(weather_ja)
['雷', '雪', '吹雪']

>>> print(weather_de)
['Gewittrig', 'Schnee', 'Schneesturm']

>>> print(weather_fr)
['Orages', 'Neige', 'Blizzard']
  • Using period in for-loop
weather_en = []
for t in EorzeaTime.weather_period(step=3):
    w = EorzeaWeather.forecast('Eureka Pyros', t)
    weather_en.append(w)
>>> print(weather_en)
['Thunder', 'Snow', 'Blizzards']
  • Provide a desired base time to calculate.
for t in EorzeaTime.weather_period(step=3, from_=datetime(2025, 10, 25).timestamp()):
    w = EorzeaWeather.forecast('Eureka Pyros', t)
    print(w)
  • Using period generator directly
weathers = EorzeaWeather.forecast('Eureka Pyros', EorzeaTime.weather_period(step=3))
>>> print(weathers)
['Thunder', 'Snow', 'Blizzards']

Eorzea place name

An instance of EorzeaPlaceName would be always a valid place name in this pacakge.

An invalid place name will raises InvalidEorzeaPlaceName error.

place_name = EorzeaPlaceName(
    'The Ruby Sea',
    # `False` to fuzzy mode, default is `True`
    strict=True,
    # Stricted scope for validation of place name.
    # default is all supports locale.
    locale_scopes=[
        EorzeaLang.EN,
        EorzeaLang.JA,
        EorzeaLang.FR,
        EorzeaLang.DE],
    # Used in fuzzy mode to cut-off the result under the score.
    # default is `80`.
    fuzzy_cutoff=80
)
>>> place_name
EorrzeaPlaceName('The Ruby Sea')

>>> print(place_name)
'The Ruby Sea`

Belowings are valid place names in strict mode with full locale scopes (default settings).

EorzeaPlaceName('The Ruby Sea') # valid `The Ruby Sea`
EorzeaPlaceName('the ruby sea') # valid `The Ruby Sea`
EorzeaPlaceName('ruby sea') # valid `The Ruby Sea`
EorzeaPlaceName('rubinsee') # valid `Rubinsee`
EorzeaPlaceName('紅玉海') # valid `紅玉海`

With stricted scopes.

scopes = [EorzeaLang.JA, EorzeaLang.DE]

EorzeaPlaceName('The Ruby Sea', locale_scopes=scopes) # raises error
EorzeaPlaceName('the ruby sea', locale_scopes=scopes) # raises error
EorzeaPlaceName('ruby sea', locale_scopes=scopes) # raises error
EorzeaPlaceName('rubinsee', locale_scopes=scopes) # valid `Rubinsee`
EorzeaPlaceName('紅玉海', locale_scopes=scopes) # valid `紅玉海`

In fuzzy mode.

EorzeaPlaceName('the ruby see', strict=False) # valid `The Ruby Sea`
EorzeaPlaceName('ruby see', strict=False) # valid `The Ruby Sea`
EorzeaPlaceName('rubisee', strict=False) # valid `Rubinsee`
EorzeaPlaceName('紅玉貝', strict=False) # raises error
EorzeaPlaceName('紅玉貝', strict=False, fuzzy_cutoff=66) # valid `紅玉海`

Eorzea rainbow predict

Use EorzeaRainbow to predict when will the rainbow appears.

from datetime import datetime

from EorzeaEnv import EorzeaPlaceName, EorzeaRainbow, EorzeaTime, EorzeaWeather

rainbow_times: list[datetime] = []

place = EorzeaPlaceName("東ラノシア")
the_rainbow = EorzeaRainbow(place_name=place)


for t in EorzeaTime.weather_period(step='inf'):
    the_rainbow.append(t, EorzeaWeather.forecast(place, t, raw=True))
    if the_rainbow.is_appear:
        rainbow_times.append(datetime.fromtimestamp(t))
    if len(rainbow_times) == 20:
        break

print(rainbow_times)

Errors

from EorzeaEnv.errors import \
    EorzeaEnvError, \
    InvalidEorzeaPlaceName, \
    WeatherRateDataError
Exception
    |- EorzeaEnvError
        |- InvalidEorzeaPlaceName
        |- WeatherRateDataError

Thanks

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eorzeaenv-2.2.14.tar.gz (81.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eorzeaenv-2.2.14-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

File details

Details for the file eorzeaenv-2.2.14.tar.gz.

File metadata

  • Download URL: eorzeaenv-2.2.14.tar.gz
  • Upload date:
  • Size: 81.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.13 Linux/6.17.0-1008-azure

File hashes

Hashes for eorzeaenv-2.2.14.tar.gz
Algorithm Hash digest
SHA256 d00564dd12f47829ae8e01247b4b40b19237b3afdcfa1f749c96c07f79ab09ea
MD5 5346f7f7c7ab345f98aff3d8f2374bef
BLAKE2b-256 ddf85c08d537d1cac4a867fd1e98488da8f7c735f57138554863ca95fe028adc

See more details on using hashes here.

File details

Details for the file eorzeaenv-2.2.14-py3-none-any.whl.

File metadata

  • Download URL: eorzeaenv-2.2.14-py3-none-any.whl
  • Upload date:
  • Size: 86.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.13 Linux/6.17.0-1008-azure

File hashes

Hashes for eorzeaenv-2.2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 6d27b8832cbeb119e8c797270eec666575c7d756aa90bd3c8274b5650f19c14f
MD5 58d4780f2d50f8c2f18e78aa0915dc3e
BLAKE2b-256 9d3376b04b773080c127690026749733dbf7e6aa88c654b59f96335c9eb7acf4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.2.14 This release

2 files

2.2.13

2 files

2.2.12

2 files

2.2.11

2 files

2.2.10

2 files

2.2.9

2 files

2.2.8

2 files

2.2.7

2 files

2.2.6

2 files

2.2.5

2 files

2.2.4

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.4.6

1 file

1.4.5

1 file

1.4.4

1 file

1.4.3

1 file

1.4.2

1 file

1.4.1

1 file

1.4.0

1 file

1.3.0

1 file

1.2.12

1 file

1.2.11

1 file

1.2.10

1 file

1.2.9

1 file

1.2.8

1 file

1.2.7

1 file

1.2.6

1 file

1.2.5

1 file

1.2.4

1 file

1.2.3

1 file

1.2.2

1 file

1.2.1

1 file

1.2.0

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page