refactor the name of the dataset file

This commit is contained in:
lda committed 2025-05-07 03:12:22 +07:00
1 parent 587b681899
commit 754deca716
9 files changed
+16231 -14441

No files matched your search

+4 -2
View File
@@ -14,8 +14,10 @@ how to git? do not `push --force`. prefer pull requests. its like github
we will plan to do this in multiple different ways using scikit-learn and pytorch. tensorflow is ancient.
> [!IMPORTANT]
> phase out tensorflow. dont use it.
> [!NOTE]
> ~phase out tensorflow. dont use it.~
>
> its 2 different platforms for 2 different types of people. use whatever ig
maybe also fit more weather related stats? this dataset is taken from nasa so sources are there
-14429
View File
File diff suppressed because it is too large. Load diff
+6 -3
View File
@@ -1,10 +1,11 @@
import urllib.parse
import urllib.request
from datetime import datetime
from global_config import DATA_FILE_NAME
# Define parameters
latitude, longitude = 21.04815477090267, 105.80123159165096 # lmao
start_date = "2010-01-01"
start_date = "1981-01-01"
end_date = datetime.now().strftime("%Y-%m-%d") # Today's date
# Define desired parameters
@@ -16,9 +17,11 @@ end_date = datetime.now().strftime("%Y-%m-%d") # Today's date
# WS10M MERRA-2 Wind Speed at 10 Meters (m/s)
# WD10M MERRA-2 Wind Direction at 10 Meters (Degrees)
# more at https://power.larc.nasa.gov/data-access-viewer/
weather_params = ["QV2M"]
params = {
"parameters": "QV2M,T2M,PRECTOTCORR",
"parameters": ",".join(weather_params),
"community": "RE",
"longitude": longitude,
"latitude": latitude,
@@ -40,7 +43,7 @@ try:
with urllib.request.urlopen(url) as response:
if response.status == 200:
csv_data = response.read().decode("utf-8")
with open("hanoi_weather_data.csv", "w", encoding="utf-8") as file:
with open(DATA_FILE_NAME, "w", encoding="utf-8") as file:
file.write(csv_data)
print("Data successfully downloaded and saved to 'hanoi_weather_data.csv'.")
else:
+1
View File
@@ -0,0 +1 @@
DATA_FILE_NAME = "hanoi_weather_data.csv"
+16207
View File
File diff suppressed because it is too large. Load diff
+9 -4
View File
@@ -7,6 +7,8 @@ from typing import Union
import pandas as pd
from global_config import DATA_FILE_NAME
def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]):
headers = []
@@ -73,15 +75,18 @@ def validate_view(data: pd.DataFrame, verbose=False):
return data
# if __name__ == "__main__":
def load_this_data(filename, verbose=False):
d = load_data(filename)
def load_this_data(filename=DATA_FILE_NAME, verbose=False, *a):
d = load_data(filename, *a)
# if verbose:
# print(d.columns)
d = date_combine(d)
# if verbose:
# print(d.columns)
d = validate_view(d, verbose)
# if verbose:
if verbose:
print(d.head())
# print(d.columns)
return d
if __name__ == "__main__":
load_this_data(verbose=True)
+2 -1
View File
@@ -138,7 +138,8 @@
],
"source": [
"# data_file = \"hanoi_qv2m_latest.csv\"\n",
"data_file = \"dataset.csv\"\n",
"# data_file = \"dataset.csv\"\n",
"from global_config import DATA_FILE_NAME as data_file\n",
"\n",
"data = pd.read_csv(\n",
" data_file,\n",
+2 -1
View File
@@ -8,7 +8,7 @@ from sklearn.preprocessing import MinMaxScaler
import numpy as np
from load_data import load_this_data
a = load_this_data("dataset.csv")
a = load_this_data()
# time series forecasting
@@ -19,6 +19,7 @@ scaled_data = scaler.fit_transform(a)
def create_sequences(data, seq_length):
"see this? return[0] is the big x and return[1] is the big y. and h(x) = y. and h(x) is the model."
xs = []
ys = []
for i in range(len(data) - seq_length):
-1
View File
@@ -1 +0,0 @@
>no ewy