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. we will plan to do this in multiple different ways using scikit-learn and pytorch. tensorflow is ancient.
> [!IMPORTANT] > [!NOTE]
> phase out tensorflow. dont use it. > ~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 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.parse
import urllib.request import urllib.request
from datetime import datetime from datetime import datetime
from global_config import DATA_FILE_NAME
# Define parameters # Define parameters
latitude, longitude = 21.04815477090267, 105.80123159165096 # lmao 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 end_date = datetime.now().strftime("%Y-%m-%d") # Today's date
# Define desired parameters # 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) # WS10M MERRA-2 Wind Speed at 10 Meters (m/s)
# WD10M MERRA-2 Wind Direction at 10 Meters (Degrees) # WD10M MERRA-2 Wind Direction at 10 Meters (Degrees)
# more at https://power.larc.nasa.gov/data-access-viewer/ # more at https://power.larc.nasa.gov/data-access-viewer/
weather_params = ["QV2M"]
params = { params = {
"parameters": "QV2M,T2M,PRECTOTCORR", "parameters": ",".join(weather_params),
"community": "RE", "community": "RE",
"longitude": longitude, "longitude": longitude,
"latitude": latitude, "latitude": latitude,
@@ -40,7 +43,7 @@ try:
with urllib.request.urlopen(url) as response: with urllib.request.urlopen(url) as response:
if response.status == 200: if response.status == 200:
csv_data = response.read().decode("utf-8") 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) file.write(csv_data)
print("Data successfully downloaded and saved to 'hanoi_weather_data.csv'.") print("Data successfully downloaded and saved to 'hanoi_weather_data.csv'.")
else: 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 import pandas as pd
from global_config import DATA_FILE_NAME
def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]): def cut_headers(stream: Union[io.StringIO, io.FileIO, io.TextIOWrapper]):
headers = [] headers = []
@@ -73,15 +75,18 @@ def validate_view(data: pd.DataFrame, verbose=False):
return data return data
# if __name__ == "__main__": def load_this_data(filename=DATA_FILE_NAME, verbose=False, *a):
def load_this_data(filename, verbose=False): d = load_data(filename, *a)
d = load_data(filename)
# if verbose: # if verbose:
# print(d.columns) # print(d.columns)
d = date_combine(d) d = date_combine(d)
# if verbose: # if verbose:
# print(d.columns) # print(d.columns)
d = validate_view(d, verbose) d = validate_view(d, verbose)
# if verbose: if verbose:
print(d.head())
# print(d.columns) # print(d.columns)
return d return d
if __name__ == "__main__":
load_this_data(verbose=True)
+2 -1
View File
@@ -138,7 +138,8 @@
], ],
"source": [ "source": [
"# data_file = \"hanoi_qv2m_latest.csv\"\n", "# 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", "\n",
"data = pd.read_csv(\n", "data = pd.read_csv(\n",
" data_file,\n", " data_file,\n",
+2 -1
View File
@@ -8,7 +8,7 @@ from sklearn.preprocessing import MinMaxScaler
import numpy as np import numpy as np
from load_data import load_this_data from load_data import load_this_data
a = load_this_data("dataset.csv") a = load_this_data()
# time series forecasting # time series forecasting
@@ -19,6 +19,7 @@ scaled_data = scaler.fit_transform(a)
def create_sequences(data, seq_length): 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 = [] xs = []
ys = [] ys = []
for i in range(len(data) - seq_length): for i in range(len(data) - seq_length):
-1
View File
@@ -1 +0,0 @@
>no ewy