|
78 | 78 | "source": [ |
79 | 79 | "## Download the ECCO output\n", |
80 | 80 | "\n", |
81 | | - "If you haven't been through the Using Python to Download ECCO Datasets tutorial yet, I recommend going through it before proceeding further with this tutorial. If you've done that tutorial, you can save the [ecco_download.py](https://raw.githubusercontent.com/ECCO-GROUP/ECCO-v4-Python-Tutorial/master/ECCO-ACCESS/Downloading_ECCO_datasets_from_PODAAC/ecco_download.py) file on your local machine and use it to get the output we need to assess geostrophic balance.\n", |
| 81 | + "If you haven't been through the Using Python to Download ECCO Datasets tutorial yet, I recommend going through it before proceeding further with this tutorial.\n", |
82 | 82 | "\n", |
83 | 83 | "What fields will we need? Look at the geostrophic balance equations. On the left-hand side, the Coriolis parameter $f$ is a function of latitude which we can compute, so we only need to download horizontal velocities $u$ and $v$. On the right-hand side we need density $\\rho$ and pressure $p$, as well as the grid parameters that allow us to compute spatial derivatives.\n", |
84 | 84 | "\n", |
|
103 | 103 | "Now that the datasets we need have been identified, let's download them for the month of January 2000.\n", |
104 | 104 | "\n", |
105 | 105 | "\n", |
106 | | - "> Tip: do you find yourself having to say \"PO.DAAC\", and wondering if you have to spell out all of those letters? Please don't...spare yourself! It's pronounced Poh-dack, and rhymes with \"low stack\", as in the amount of homework you can only hope for as a 1st year PO grad student. :-o" |
| 106 | + "> Tip: do you find yourself having to say \"PO.DAAC\", and wondering if you have to spell out all of those letters? Please don't...spare yourself! It's pronounced Poh-dack, and rhymes with \"low stack\", as in the amount of homework you can only hope for as a 1st year grad student. :-o\n", |
| 107 | + "\n", |
| 108 | + "\n", |
| 109 | + "### Download to your local machine\n", |
| 110 | + "\n", |
| 111 | + "This sub-section uses the `ecco_download.py` module to help get the datasets needed for this tutorial onto your local machine (laptop, university computing server, etc.) where you can use them offline. Download the module using [this link](https://raw.githubusercontent.com/ECCO-GROUP/ECCO-v4-Python-Tutorial/master/ECCO-ACCESS/Downloading_ECCO_datasets_from_PODAAC/ecco_download.py), and then run the cells below.\n", |
| 112 | + "\n", |
| 113 | + "> Tip: If you are running these tutorials on an instance in the Amazon Web Services (AWS) cloud, skip these cells and instead run the next section, [Download to your AWS instance](https://ecco-v4-python-tutorial.readthedocs.io/Geostrophic_balance.html#Download-to-your-AWS-instance)." |
107 | 114 | ] |
108 | 115 | }, |
109 | 116 | { |
|
176 | 183 | ], |
177 | 184 | "source": [ |
178 | 185 | "# download file (granule) containing Jan 2000 velocities,\n", |
179 | | - "# to default path ~/Downloads/ECCO_V4r4_PODAAC/\n", |
| 186 | + "download_root_dir = join(user_home_dir,'Downloads','ECCO_V4r4_PODAAC') # this is the default path used for download_root_dir\n", |
180 | 187 | "vel_monthly_shortname = \"ECCO_L4_OCEAN_VEL_LLC0090GRID_MONTHLY_V4R4\"\n", |
181 | 188 | "ecco_podaac_download(ShortName=vel_monthly_shortname,\\\n", |
182 | | - " StartDate=\"2000-01-01\",EndDate=\"2000-01-31\",download_root_dir=None,\\\n", |
| 189 | + " StartDate=\"2000-01\",EndDate=\"2000-01\",download_root_dir=download_root_dir,\\\n", |
183 | 190 | " n_workers=6,force_redownload=False)" |
184 | 191 | ] |
185 | 192 | }, |
|
209 | 216 | "# to default path ~/Downloads/ECCO_V4r4_PODAAC/\n", |
210 | 217 | "denspress_monthly_shortname = \"ECCO_L4_DENS_STRAT_PRESS_LLC0090GRID_MONTHLY_V4R4\"\n", |
211 | 218 | "ecco_podaac_download(ShortName=denspress_monthly_shortname,\\\n", |
212 | | - " StartDate=\"2000-01-01\",EndDate=\"2000-01-31\",download_root_dir=None,\\\n", |
| 219 | + " StartDate=\"2000-01\",EndDate=\"2000-01\",download_root_dir=None,\\\n", |
213 | 220 | " n_workers=6,force_redownload=False)" |
214 | 221 | ] |
215 | 222 | }, |
216 | 223 | { |
217 | 224 | "cell_type": "markdown", |
218 | 225 | "metadata": {}, |
219 | 226 | "source": [ |
220 | | - "Notice that the StartDate for each of the downloads was set to the 2nd of the month (2000-01-02) not the 1st. If it is set to the 1st, then the file for Dec 1999 will also be downloaded (which ends on 2000-01-01).\n", |
221 | | - "\n", |
222 | 227 | "Once you have downloaded the monthly files for velocities and density/pressure, let's also download daily files for each (2000-01-01). Consulting the \"Daily Means\" list of variables, the ShortNames of the datasets needed are very similar; MONTHLY is just replaced with DAILY." |
223 | 228 | ] |
224 | 229 | }, |
|
306 | 311 | "cell_type": "markdown", |
307 | 312 | "metadata": {}, |
308 | 313 | "source": [ |
309 | | - "Now check the directory where the ECCO output was downloaded to, this will be under ~/Downloads/ECCO_V4r4_PODAAC/ unless you changed the path under the ```download_root_dir``` option. There should be (at least) 5 subfolders corresponding to 2 datasets each of monthly and daily means, as well as a folder for the grid parameters. The monthly mean folders contain 1 file each for Jan 2000, the daily mean folders contain 2 files each (1999-12-31 and 2000-01-01)." |
| 314 | + "Now check the directory where the ECCO output was downloaded to, this will be under ~/Downloads/ECCO_V4r4_PODAAC/ unless you changed the path under the ```download_root_dir``` option. There should be (at least) 5 subfolders corresponding to 2 datasets each of monthly and daily means, as well as a folder for the grid parameters. The monthly mean folders contain 1 file each for Jan 2000, the daily mean folders contain 1 file each for 2000-01-01.\n", |
| 315 | + "\n", |
| 316 | + "\n", |
| 317 | + "### Download to your AWS instance\n", |
| 318 | + "\n", |
| 319 | + "The cell below uses the `ecco_s3_retrieve.py` module to download to your instance (or open remotely) the datasets you need for this tutorial. If you followed the setup instructions in the [AWS Cloud setup](https://ecco-v4-python-tutorial.readthedocs.io/AWS_Cloud_getting_started.html) tutorial you already have access to this module, or you can download it [here](https://raw.githubusercontent.com/ECCO-GROUP/ECCO-v4-Python-Tutorial/master/ECCO-ACCESS/ecco_s3_retrieve.py).\n", |
| 320 | + "\n", |
| 321 | + "> Tip: In future tutorials, you will see there is a boolean variable `incloud_access` that is usually set to `False` by default. If you set this variable to `True`, the `ecco_s3_retrieve.py` module will access the datasets on the cloud properly from your instance." |
| 322 | + ] |
| 323 | + }, |
| 324 | + { |
| 325 | + "cell_type": "code", |
| 326 | + "execution_count": null, |
| 327 | + "metadata": {}, |
| 328 | + "outputs": [], |
| 329 | + "source": [ |
| 330 | + "# # only need this if ecco_s3_retrieve.py is in a different directory than the tutorial notebook\n", |
| 331 | + "# import sys\n", |
| 332 | + "# sys.path.append('/home/user/some_other_directory')\n", |
| 333 | + "\n", |
| 334 | + "# load module into workspace\n", |
| 335 | + "from ecco_s3_retrieve import *\n", |
| 336 | + "# query to see the syntax needed for the ecco_podaac_s3_get_diskaware function,\n", |
| 337 | + "# which assesses available disk space to make sure that there is sufficient storage to download the ECCO datasets,\n", |
| 338 | + "# and opens them \"remotely\" on S3 otherwise\n", |
| 339 | + "help(ecco_podaac_s3_get_diskaware)" |
| 340 | + ] |
| 341 | + }, |
| 342 | + { |
| 343 | + "cell_type": "code", |
| 344 | + "execution_count": null, |
| 345 | + "metadata": {}, |
| 346 | + "outputs": [], |
| 347 | + "source": [ |
| 348 | + "incloud_access = True\n", |
| 349 | + "\n", |
| 350 | + "ShortNames_monthly_list = [\"ECCO_L4_OCEAN_VEL_LLC0090GRID_MONTHLY_V4R4\",\\\n", |
| 351 | + " \"ECCO_L4_DENS_STRAT_PRESS_LLC0090GRID_MONTHLY_V4R4\"]\n", |
| 352 | + "ShortNames_daily_list = [\"ECCO_L4_OCEAN_VEL_LLC0090GRID_DAILY_V4R4\",\\\n", |
| 353 | + " \"ECCO_L4_DENS_STRAT_PRESS_LLC0090GRID_DAILY_V4R4\"]\n", |
| 354 | + "if incloud_access == True:\n", |
| 355 | + " download_root_dir = join(user_home_dir,'Downloads','ECCO_V4r4_PODAAC')\n", |
| 356 | + " files_nested_list = ecco_podaac_s3_get_diskaware(ShortNames=ShortNames_monthly_list,\\\n", |
| 357 | + " StartDate='2000-01',EndDate='2000-01',\\\n", |
| 358 | + " max_avail_frac=0.5,\\\n", |
| 359 | + " download_root_dir=download_root_dir)\n", |
| 360 | + " files_nested_list = ecco_podaac_s3_get_diskaware(ShortNames=ShortNames_daily_list,\\\n", |
| 361 | + " StartDate='2000-01-01',EndDate='2000-01-01',\\\n", |
| 362 | + " max_avail_frac=0.5,\\\n", |
| 363 | + " download_root_dir=download_root_dir)" |
310 | 364 | ] |
311 | 365 | }, |
312 | 366 | { |
|
349 | 403 | "import matplotlib.pyplot as plt\n", |
350 | 404 | "\n", |
351 | 405 | "# locate files to load\n", |
352 | | - "download_root_dir = join(user_home_dir,'Downloads','ECCO_V4r4_PODAAC')\n", |
353 | 406 | "download_dir = join(download_root_dir,denspress_monthly_shortname)\n", |
354 | 407 | "curr_denspress_files = list(glob.glob(join(download_dir,'*nc')))\n", |
355 | 408 | "\n", |
|
5317 | 5370 | ], |
5318 | 5371 | "source": [ |
5319 | 5372 | "# locate files to load\n", |
5320 | | - "download_root_dir = join(user_home_dir,'Downloads','ECCO_V4r4_PODAAC')\n", |
5321 | 5373 | "download_dir = join(download_root_dir,vel_monthly_shortname)\n", |
5322 | 5374 | "curr_vel_files = list(glob.glob(join(download_dir,'*nc')))\n", |
5323 | 5375 | "\n", |
|
7558 | 7610 | "name": "python", |
7559 | 7611 | "nbconvert_exporter": "python", |
7560 | 7612 | "pygments_lexer": "ipython3", |
7561 | | - "version": "3.9.13" |
| 7613 | + "version": "3.11.8" |
7562 | 7614 | }, |
7563 | 7615 | "vscode": { |
7564 | 7616 | "interpreter": { |
|
7567 | 7619 | } |
7568 | 7620 | }, |
7569 | 7621 | "nbformat": 4, |
7570 | | - "nbformat_minor": 2 |
| 7622 | + "nbformat_minor": 4 |
7571 | 7623 | } |
0 commit comments