karadagi commited on
Commit
8350010
·
verified ·
1 Parent(s): ef585ab

Upload YEL_2_0_Inference.ipynb

Browse files
Files changed (1) hide show
  1. YEL_2_0_Inference.ipynb +23 -11
YEL_2_0_Inference.ipynb CHANGED
@@ -20,7 +20,7 @@
20
  "| `building_height` | Building height at the point (m) |\n",
21
  "| `u_ratio` | Atmospheric-profile velocity at `z_relative`, divided by reference velocity |\n",
22
  "\n",
23
- "The notebook reads these features from `Test.csv` in the current working directory."
24
  ]
25
  },
26
  {
@@ -58,7 +58,8 @@
58
  "REQUIRED_COLUMNS = [\"x\", \"y\", \"z_relative\", \"sdf\", \"building_height\", \"u_ratio\"]\n",
59
  "\n",
60
  "# User settings\n",
61
- "INPUT_CSV = Path(\"Test.csv\")\n",
 
62
  "WIND_DIRECTIONS_DEG = list(range(0, 360, 45)) # 0°, 45°, ..., 315°\n",
63
  "REFERENCE_WIND_SPEED = 5.0 # Uref in m/s\n",
64
  "OUTPUT_CSV = Path(\"yel_predictions.csv\")"
@@ -68,7 +69,17 @@
68
  "cell_type": "markdown",
69
  "metadata": {},
70
  "source": [
71
- "## Load features from `Test.csv`"
 
 
 
 
 
 
 
 
 
 
72
  ]
73
  },
74
  {
@@ -77,14 +88,15 @@
77
  "metadata": {},
78
  "outputs": [],
79
  "source": [
80
- "if not INPUT_CSV.is_file():\n",
81
- " raise FileNotFoundError(\n",
82
- " f\"Could not find {INPUT_CSV.resolve()}. Upload Test.csv to the Colab session \"\n",
83
- " \"before running this cell.\"\n",
84
- " )\n",
85
- "\n",
86
- "features = pd.read_csv(INPUT_CSV)\n",
87
- "print(f\"Loaded {len(features):,} rows from {INPUT_CSV.resolve()}\")\n",
 
88
  "\n",
89
  "missing = sorted(set(REQUIRED_COLUMNS) - set(features.columns))\n",
90
  "if missing:\n",
 
20
  "| `building_height` | Building height at the point (m) |\n",
21
  "| `u_ratio` | Atmospheric-profile velocity at `z_relative`, divided by reference velocity |\n",
22
  "\n",
23
+ "By default, the notebook loads these features from the public `Test.csv` file in the YEL 2.0 Hugging Face repository. You can instead provide a local or uploaded CSV file."
24
  ]
25
  },
26
  {
 
58
  "REQUIRED_COLUMNS = [\"x\", \"y\", \"z_relative\", \"sdf\", \"building_height\", \"u_ratio\"]\n",
59
  "\n",
60
  "# User settings\n",
61
+ "INPUT_CSV_URL = \"https://huggingface.co/SustainableUrbanSystemsLab/Yel-2.0/resolve/main/Test.csv\"\n",
62
+ "LOCAL_CSV = None # Example: Path(\"/content/my_features.csv\")\n",
63
  "WIND_DIRECTIONS_DEG = list(range(0, 360, 45)) # 0°, 45°, ..., 315°\n",
64
  "REFERENCE_WIND_SPEED = 5.0 # Uref in m/s\n",
65
  "OUTPUT_CSV = Path(\"yel_predictions.csv\")"
 
69
  "cell_type": "markdown",
70
  "metadata": {},
71
  "source": [
72
+ "## Load input CSV\n",
73
+ "\n",
74
+ "The hosted `Test.csv` is used when `LOCAL_CSV` is `None`.\n",
75
+ "\n",
76
+ "To use your own file in Google Colab:\n",
77
+ "\n",
78
+ "1. Open the **Files** panel on the left.\n",
79
+ "2. Click **Upload to session storage** and select your CSV.\n",
80
+ "3. Set `LOCAL_CSV = Path(\"/content/your_file.csv\")` in the settings cell.\n",
81
+ "\n",
82
+ "Your CSV must contain the required columns listed at the top of this notebook."
83
  ]
84
  },
85
  {
 
88
  "metadata": {},
89
  "outputs": [],
90
  "source": [
91
+ "if LOCAL_CSV is None:\n",
92
+ " input_source = INPUT_CSV_URL\n",
93
+ "else:\n",
94
+ " input_source = Path(LOCAL_CSV)\n",
95
+ " if not input_source.is_file():\n",
96
+ " raise FileNotFoundError(f\"Could not find local CSV: {input_source.resolve()}\")\n",
97
+ "\n",
98
+ "features = pd.read_csv(input_source)\n",
99
+ "print(f\"Loaded {len(features):,} rows from {input_source}\")\n",
100
  "\n",
101
  "missing = sorted(set(REQUIRED_COLUMNS) - set(features.columns))\n",
102
  "if missing:\n",