Skip to content

Commit

Permalink
date from version
Browse files Browse the repository at this point in the history
  • Loading branch information
tillwenke committed Jan 12, 2025
1 parent b2ba38d commit be4326d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions heatchmap/gpmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,19 @@ def __init__(self, region="world", resolution=10, version="prod", visual:bool=Fa

super().__init__(method=type(self.gpr).__name__, region=region, resolution=resolution, version=version, verbose=False)

ds = load_dataset("tillwenke/heatchmap-map", cache_dir=f"{HERE}/cache/huggingface")
ds = ds.with_format("np")
self.raw_raster = ds["train"]["numpy"]
self.map_dataset = load_dataset("tillwenke/heatchmap-map", cache_dir=f"{HERE}/cache/huggingface")
self.map_dataset = self.map_dataset.with_format("np")
self.raw_raster = self.map_dataset["train"]["numpy"]

# files = glob.glob(f"intermediate/map_{self.method}_{self.region}_{self.resolution}_{self.version}*.txt")

self.begin = pd.Timestamp("2024-12-21") # TODO: read latest date from somewhere
last_map_update = self.map_dataset["train"].info.version
if last_map_update == "0.0.0":
self.begin = pd.Timestamp(self.today.date() - pd.Timedelta(days=1))
print("No map update found. Using yesterday as begin date.")
else:
self.begin = pd.Timestamp(last_map_update)
print(f"Last map update was on {self.begin.date()}.")

self.batch_size = 10000
self.today = pd.Timestamp.now()
Expand Down Expand Up @@ -298,4 +304,5 @@ def upload(self):
ds = ds.with_format("np")
print(ds["numpy"].shape)
ds.info.version = str(self.today)
ds.push_to_hub("tillwenke/heatchmap-map")
ds.push_to_hub("tillwenke/heatchmap-map")
print("Uploaded new map to Hugging Face dataset hub.")
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import setuptools

VERSION = "0.1.16"
VERSION = "0.1.17"

NAME = "heatchmap"

Expand Down

0 comments on commit be4326d

Please sign in to comment.