Skip to content

Feature/ingestion - #9

Open
ChunEnLin wants to merge 18 commits into
mainfrom
feature/ingestion
Open

Feature/ingestion#9
ChunEnLin wants to merge 18 commits into
mainfrom
feature/ingestion

Conversation

@ChunEnLin

Copy link
Copy Markdown

差不多完成了,但有幾個部分需要在使用者執行前去修改:
1.input_filepath
2.my_gee_project
3.gadm_filepath

另外,目前是設定只會跑前100筆資料
df_to_process = df_processed.iloc[0:100].copy()

另外,pyproject.toml 的依賴套件有 geemap,但這個我只有用在 demos/ingestion_test.ipynb 裡面,src/ingestion.py 並沒有用到這個套件

@ChunEnLin ChunEnLin closed this Feb 3, 2026
@ChunEnLin ChunEnLin reopened this Feb 3, 2026
@YenCheng1226 YenCheng1226 added the enhancement New feature or request label Feb 3, 2026
@YenCheng1226 YenCheng1226 self-assigned this Feb 3, 2026
@YenCheng1226
YenCheng1226 self-requested a review February 3, 2026 12:18

@YenCheng1226 YenCheng1226 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

資料處理的流程目前都沒有問題!我有幫你新增了資料處理核心function 的 unit test ,另外GEE 的環境依賴問題正好提醒我,之後我們需要改成將使用者下載 GEE 的 GADM 資料到本地寫成另外的function,ingestion.py 只處理 gadm input 和 output 的問題,這個問題我們下次開會會討論,有沒有更好的解法

Comment thread src/ingestion.py
Comment on lines +12 to +20
# Initialize GEE (in order to access GAUL dataset in GEE)
def initialize_gee(gee_project):
try:
ee.Initialize(project=gee_project)
print("Earth Engine initialized successfully.")
except Exception:
print("you need to authenticate GEE:")
ee.Authenticate() # Need to authenticate only once
ee.Initialize(project=gee_project)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initialization 目前是硬編碼指定的 gee_project ,團隊協作如果成員的 gee_project 名稱不一樣,run 這份 code 就會出 bug ,也提醒我 initialization 應該另外寫成 module,這部分我之後會優先處理

Comment thread src/ingestion.py
# Main function
def main():
# Filepath settings & Google Earth Engine project name setting
input_filepath = "/home/chunen/nas/HAZAMA_data/public_emdat_custom_request_2026-01-28.csv" # noqa: E501

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊需要改成不依賴既有路徑和環境的方式,情境是:如果是新的使用者使用,他要能重新下載到本地端進行處理,只需要指定的python 環境就可以run

Comment thread src/ingestion.py
# Filepath settings & Google Earth Engine project name setting
input_filepath = "/home/chunen/nas/HAZAMA_data/public_emdat_custom_request_2026-01-28.csv" # noqa: E501
# output_filepath = "/home/chunen/HAZAMA/HAZAMA/outputs/data_ingestion.csv"
my_gee_project = "oceanic-hash-467505-r2"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

前面有說到,這裡hard-coding成個人的 gee_project ,之後其他人進來接者開發會有依賴問題

Comment thread src/ingestion.py
# output_filepath = "/home/chunen/HAZAMA/HAZAMA/outputs/data_ingestion.csv"
my_gee_project = "oceanic-hash-467505-r2"
# GADM GeoPackage filepath setting
gadm_filepath = "/home/chunen/nas/HAZAMA_data/gadm_410-levels-ADM2.gpkg" # noqa: E501

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要改成使用者本地端的folder

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這是我新增的unit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants