Skip to content

Commit

Permalink
Update filepaths
Browse files Browse the repository at this point in the history
  • Loading branch information
slesaad committed Jan 28, 2024
1 parent 91a741c commit ae08316
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"# Import required libraries\n",
"\n",
"# import earthaccess\n",
"import os\n",
"import warnings\n",
"import requests\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -110,8 +111,8 @@
"# Loading Permian Basin shape file as a ROI\n",
"# User can pass any json or shape file here\n",
"# The \"geopandas\" library makes working with geospatial data easier by facilitating spatial operations on geometric types \n",
"\n",
"permian_basin = geopandas.read_file('../use-case-3/data/permian.zip')"
"data_dir = f\"{os.getenv('HOME')}/shared/data\"\n",
"permian_basin = geopandas.read_file(f'{data_dir}/use-case-3/Permian.zip')"
]
},
{
Expand Down
21 changes: 11 additions & 10 deletions sections/use-case-2/lpjwsl-wetlandch4-grid-v1_User_Notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@
"metadata": {},
"outputs": [],
"source": [
"import earthaccess\n",
"# import earthaccess\n",
"import os\n",
"import warnings\n",
"import requests\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -317,11 +318,11 @@
"metadata": {},
"outputs": [],
"source": [
"merra_t2m_dir='data/merra_t2m_dir/'\n",
"merra_soil_moisture_dir = 'data/merra_soil_moisture_dir/'\n",
"merra_precip_rate_dir = 'data/merra_precip_rate_dir/'\n",
"merra_t2m_clim_dir = 'data/merra_t2m_clim_dir/'\n",
"savedir = 'data/saved_files'\n",
"data_dir = f\"{os.getenv('HOME')}/shared/data/use-case-2\" \n",
"merra_t2m_dir=f'{data_dir}/merra_t2m_dir/'\n",
"merra_soil_moisture_dir = f'{data_dir}/merra_soil_moisture_dir/'\n",
"merra_precip_rate_dir = f'{data_dir}/merra_precip_rate_dir/'\n",
"merra_t2m_clim_dir = f'{data_dir}/merra_t2m_clim_dir/'\n",
"\n",
"merra_precip_rate_clim_dir = merra_t2m_clim_dir \n",
"merra_soil_moisture_clim_dir = merra_t2m_clim_dir"
Expand Down Expand Up @@ -616,7 +617,7 @@
"\n",
"\n",
"# Insert the path to the NetCDF file\n",
"file_path = 'data/merra_t2m_dir/1991/MERRA2_100.instM_2d_asm_Nx.199101.nc4' # Replace with the path to your NetCDF file\n",
"file_path = f'{data_dir}/merra_t2m_dir/1991/MERRA2_100.instM_2d_asm_Nx.199101.nc4' # Replace with the path to your NetCDF file\n",
"dataset = nc.Dataset(file_path)\n",
"\n",
"\n",
Expand Down Expand Up @@ -953,14 +954,14 @@
" ax.legend(loc='best')\n",
" nickname = params[p]['nickname']\n",
" savename = '%s/box_summed_%s_%s_%s.png'% \\\n",
" (savedir,nickname,year,focus)\n",
" (nickname,year,focus)\n",
" if anomaly:\n",
" ax.plot(list(range(-1,13)),np.zeros(14),linewidth=0.4)\n",
" savename = savename.replace('.png','_Anomaly.png')\n",
" ax.set_xlim(-1,12)\n",
" ax.set_ylim(min(ts['box_totals']),max(ts['box_totals'])) # manual per parameter\n",
" plt.show()\n",
" plt.savefig('data/saved_files/'+savename.split('/')[-1],dpi=300,bbox_inches='tight')"
" plt.savefig(savename.split('/')[-1],dpi=300,bbox_inches='tight')"
]
}
],
Expand All @@ -980,7 +981,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.9.6"
},
"vscode": {
"interpreter": {
Expand Down
52 changes: 45 additions & 7 deletions sections/use-case-3/emit-ch4plume-v1_User_Notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"\n",
"# import earthaccess\n",
"import warnings\n",
"import requests\n",
Expand Down Expand Up @@ -113,12 +115,48 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31mFailed to start the Kernel. \n",
"\u001b[1;31mJupyter server crashed. Unable to connect. \n",
"\u001b[1;31mError code from Jupyter: 1\n",
"\u001b[1;31musage: jupyter.py [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]\n",
"\u001b[1;31m [--paths] [--json] [--debug]\n",
"\u001b[1;31m [subcommand]\n",
"\u001b[1;31m\n",
"\u001b[1;31mJupyter: Interactive Computing\n",
"\u001b[1;31m\n",
"\u001b[1;31mpositional arguments:\n",
"\u001b[1;31m subcommand the subcommand to launch\n",
"\u001b[1;31m\n",
"\u001b[1;31moptions:\n",
"\u001b[1;31m -h, --help show this help message and exit\n",
"\u001b[1;31m --version show the versions of core jupyter packages and exit\n",
"\u001b[1;31m --config-dir show Jupyter config dir\n",
"\u001b[1;31m --data-dir show Jupyter data dir\n",
"\u001b[1;31m --runtime-dir show Jupyter runtime dir\n",
"\u001b[1;31m --paths show all Jupyter paths. Add --json for machine-readable\n",
"\u001b[1;31m format.\n",
"\u001b[1;31m --json output paths as machine-readable json\n",
"\u001b[1;31m --debug output debug information about paths\n",
"\u001b[1;31m\n",
"\u001b[1;31mAvailable subcommands: lite piplite\n",
"\u001b[1;31m\n",
"\u001b[1;31mJupyter command `jupyter-notebook` not found. \n",
"\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
]
}
],
"source": [
"# Loading Permian Basin shape file as a region of interest\n",
"# User can pass any json or shape file here\n",
"# The \"geopandas\" library makes working with geospatial data easier by facilitating spatial operations on geometric types \n",
"permian_basin = geopandas.read_file('data/permian.zip')\n",
"# The \"geopandas\" library makes working with geospatial data easier by facilitating spatial operations on geometric types\n",
"file_path = f\"{os.getenv('HOME')}/shared/data/use-case-3\" \n",
"permian_basin = geopandas.read_file(f\"{file_path}/Permian.zip\")\n",
"permian_basin = permian_basin.set_crs(4326,allow_override=True)"
]
},
Expand All @@ -129,18 +167,18 @@
"outputs": [],
"source": [
"# The ISS spatial coverage data is called on here\n",
"coverage = geopandas.read_file('data/coverage.json')\n",
"coverage = geopandas.read_file(f'{file_path}/coverage.json')\n",
"coverage = coverage.set_crs(4326,allow_override=True)\n",
"\n",
"# The ISS Date Time is converted to strings\n",
"coverage['new_start_time'] = coverage.start_time.astype('str')\n",
"\n",
"# locations of where plumes are detected for the August 1, 2022 - present time period\n",
"metadata_json = geopandas.read_file('data/methane_metadata.json')\n",
"metadata_json = geopandas.read_file(f'{file_path}/methane_metadata.json')\n",
"metadata_json = metadata_json.set_crs(4326,allow_override=True)\n",
"metadata_json['new_start_time'] = metadata_json['UTC Time Observed'].astype('str')\n",
"metadata_json['Scene FIDs'] = list(map(lambda x : x[0] ,metadata_json['Scene FIDs']))\n",
"target_mask = geopandas.read_file('data/target_mask.json')\n",
"target_mask = geopandas.read_file(f'{file_path}/target_mask.json')\n",
"target_mask = target_mask.set_crs(4326,allow_override=True)\n",
"\n",
"\n",
Expand Down Expand Up @@ -644,7 +682,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
"version": "3.9.6"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit ae08316

Please sign in to comment.