From 1418c929b69e51ec61f6b4f79ee67f8da6e3dae4 Mon Sep 17 00:00:00 2001 From: wwieder Date: Thu, 18 Jan 2024 12:16:22 -0700 Subject: [PATCH 1/6] point to shared directory, no dask --- examples/nblibrary/land_comparision.ipynb | 31 +++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/examples/nblibrary/land_comparision.ipynb b/examples/nblibrary/land_comparision.ipynb index 0bc2f56..8d3828d 100644 --- a/examples/nblibrary/land_comparision.ipynb +++ b/examples/nblibrary/land_comparision.ipynb @@ -65,11 +65,9 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "e0d67916-85c5-4590-b03f-c00753e88df4", + "cell_type": "raw", + "id": "2fd07a40-172e-435e-84e9-e422ae920220", "metadata": {}, - "outputs": [], "source": [ "# Updated for PBS scheduler\n", "# this could go into utils.\n", @@ -102,11 +100,9 @@ ] }, { - "cell_type": "code", - "execution_count": null, - "id": "590d68d1-7bf3-4164-911c-c6593d010246", + "cell_type": "raw", + "id": "e6c2ec6c-628c-4b0a-bb00-a2739422b4d8", "metadata": {}, - "outputs": [], "source": [ "cluster, client = get_ClusterClient(nmem='1GB')\n", "cluster.scale(10) \n", @@ -123,8 +119,8 @@ "# -- read only these variables from the whole netcdf files\n", "# average over time\n", "def preprocess (ds):\n", - " variables = ['GPP', 'TOTECOSYSC', 'TOTVEGC','ELAI','TOTSOMC',\n", - " 'SOM_PAS_C_vr','SOM_SLO_C_vr','ALT']\n", + " variables = ['TOTECOSYSC', 'TOTVEGC','TOTSOMC',\n", + " 'SOM_PAS_C_vr']\n", "\n", " ds_new= ds[variables]\n", " return ds_new\n", @@ -154,10 +150,11 @@ "for c in range(len(cases)):\n", "\n", " sim_files =[]\n", - " sim_path = \"/glade/derecho/scratch/slevis/archive/\"+cases[c]+\"/lnd/hist/\"\n", + " sim_path = \"/glade/campaign/cesm/development/cross-wg/diagnostic_framework/CESM_output_for_testing/\"\n", + " sim_path = sim_path+cases[c]+\"/lnd/hist/\"\n", " sim_files.extend(sorted(glob(join(sim_path+cases[c]+\".clm2.h0.*.nc\"))))\n", - " # subset last 20 years of data \n", - " sim_files = sim_files[-240:None]\n", + " # subset last 5 years of data \n", + " sim_files = sim_files[-60:None]\n", " print(\"All simulation files for \"+cases[c]+\": [\", len(sim_files), \"files]\")\n", "\n", " temp = xr.open_mfdataset(sim_files, decode_times=True, combine='by_coords',\n", @@ -277,6 +274,14 @@ "metadata": {}, "outputs": [], "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a6d508e9-5007-4e9a-9b1f-64a386310644", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { From 64242888a4e59a0f667781433106c2776b69359d Mon Sep 17 00:00:00 2001 From: wwieder Date: Thu, 18 Jan 2024 14:21:19 -0700 Subject: [PATCH 2/6] updates README for using fastx --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 85a1435..75d5633 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,9 @@ $ cupid-build config.yml # Will build HTML from Jupyter Book After the last step is finished, you can use Jupyter to view generated notebooks in `${CUPID_ROOT}/examples/coupled-model/computed_notebooks/quick-run` or you can copy the entire `${CUPID_ROOT}/examples/coupled-model/computed_notebooks/quick-run/_build/html` directory to your local machine and look at `index.html` in a web browser. + +The easiest way to visualize the web page on a browser is to: +1. open a new browser window that points to https://fastx.ucar.edu:3300/session/` +2. open a default desktop icon +3. select the browser client +4. type `firefox CUPiD/examples/coupled_model/computed_notebooks/quick-run/_build/html/index.html`, assuming your CUPiD is in your home directory From 12f726f5b71aea966431c2ab385f30e45708be00 Mon Sep 17 00:00:00 2001 From: wwieder Date: Thu, 18 Jan 2024 14:43:52 -0700 Subject: [PATCH 3/6] edits to README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 75d5633..dab7fe6 100644 --- a/README.md +++ b/README.md @@ -63,8 +63,8 @@ After the last step is finished, you can use Jupyter to view generated notebooks or you can copy the entire `${CUPID_ROOT}/examples/coupled-model/computed_notebooks/quick-run/_build/html` directory to your local machine and look at `index.html` in a web browser. -The easiest way to visualize the web page on a browser is to: +For users running on the NCAR super computers (derecho or casper), you can visualize the web page in a browser with the following steps: 1. open a new browser window that points to https://fastx.ucar.edu:3300/session/` 2. open a default desktop icon 3. select the browser client -4. type `firefox CUPiD/examples/coupled_model/computed_notebooks/quick-run/_build/html/index.html`, assuming your CUPiD is in your home directory +4. type `firefox CUPiD/examples/coupled_model/computed_notebooks/quick-run/_build/html/index.html` From fb48bf29bf463b6119a04f477814215397ea4e85 Mon Sep 17 00:00:00 2001 From: wwieder Date: Thu, 18 Jan 2024 14:51:53 -0700 Subject: [PATCH 4/6] correct notebook info --- examples/nblibrary/land_comparision.ipynb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/nblibrary/land_comparision.ipynb b/examples/nblibrary/land_comparision.ipynb index 8d3828d..5c9f4b8 100644 --- a/examples/nblibrary/land_comparision.ipynb +++ b/examples/nblibrary/land_comparision.ipynb @@ -20,11 +20,10 @@ "metadata": {}, "source": [ "## Simple example comparing land variables from two simulations\n", - "- Created by wwieder@ucar.edu\n", - "- Jan 2024\n", + "Created by wwieder@ucar.edu, Jan 2024\n", "\n", "- paths are harded coded for now\n", - "- quickly (and inaccurately) calcultes 20 year mean from raw, .h0., files \n", + "- quickly (and inaccurately) calcultes a 5 year mean from raw, .h0., files.\n", "- plots global means and differences which also not very nice to look at, especially since this points to a 4x5 grid." ] }, From e13966a7df11292595b8785d328d15ccca0dee12 Mon Sep 17 00:00:00 2001 From: wwieder Date: Thu, 18 Jan 2024 14:53:34 -0700 Subject: [PATCH 5/6] correct notebook info2 --- examples/nblibrary/land_comparision.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nblibrary/land_comparision.ipynb b/examples/nblibrary/land_comparision.ipynb index 5c9f4b8..e4ffbb4 100644 --- a/examples/nblibrary/land_comparision.ipynb +++ b/examples/nblibrary/land_comparision.ipynb @@ -23,7 +23,7 @@ "Created by wwieder@ucar.edu, Jan 2024\n", "\n", "- paths are harded coded for now\n", - "- quickly (and inaccurately) calcultes a 5 year mean from raw, .h0., files.\n", + "- quickly (and inaccurately) calculates 5 year mean from raw, .h0., files.\n", "- plots global means and differences which also not very nice to look at, especially since this points to a 4x5 grid." ] }, From e838cd4d06c92632c0da8982f4fb10f6410998e9 Mon Sep 17 00:00:00 2001 From: Michael Levy Date: Fri, 19 Jan 2024 10:47:31 -0700 Subject: [PATCH 6/6] Clean up README and land notebook Added a few more steps to instructions for viewing html on casper via fastx, which will hopefully be a little easier for users to follow. Also removed a few unnecessary cells from land_comparison.ipynb --- README.md | 10 ++-- examples/nblibrary/land_comparision.ipynb | 69 ----------------------- 2 files changed, 6 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index dab7fe6..4baa233 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,9 @@ or you can copy the entire `${CUPID_ROOT}/examples/coupled-model/computed_notebo directory to your local machine and look at `index.html` in a web browser. For users running on the NCAR super computers (derecho or casper), you can visualize the web page in a browser with the following steps: -1. open a new browser window that points to https://fastx.ucar.edu:3300/session/` -2. open a default desktop icon -3. select the browser client -4. type `firefox CUPiD/examples/coupled_model/computed_notebooks/quick-run/_build/html/index.html` +1. open a new browser window that points to https://fastx.ucar.edu:3300/session/ +1. open a default desktop icon +1. select the browser client +1. type `xterm` and hit enter to open a terminal +1. In the terminal, run `cd ${CUPID_ROOT}/examples/coupled_model/computed_notebooks/quick-run/_build/html` to enter the `html` directory +1. From the updated directory, run `firefox index.html &` to open a web browser pointed at the generated web page diff --git a/examples/nblibrary/land_comparision.ipynb b/examples/nblibrary/land_comparision.ipynb index e4ffbb4..9801544 100644 --- a/examples/nblibrary/land_comparision.ipynb +++ b/examples/nblibrary/land_comparision.ipynb @@ -63,51 +63,6 @@ "%matplotlib inline" ] }, - { - "cell_type": "raw", - "id": "2fd07a40-172e-435e-84e9-e422ae920220", - "metadata": {}, - "source": [ - "# Updated for PBS scheduler\n", - "# this could go into utils.\n", - "# By default gets 1 core w/ 25 GB memory\n", - "def get_ClusterClient(ncores=1, nmem='25GB'):\n", - " import dask\n", - " from dask_jobqueue import PBSCluster\n", - " from dask.distributed import Client\n", - " ncores=ncores\n", - " nmem = nmem\n", - "\n", - " cluster = PBSCluster(\n", - " cores=ncores, # The number of cores you want\n", - " memory=nmem, # Amount of memory\n", - " processes=ncores, # How many processes\n", - " queue='casper', # The type of queue to utilize (/glade/u/apps/dav/opt/usr/bin/execcasper)\n", - " resource_spec='select=1:ncpus='+str(ncores)+':mem='+nmem, # Specify resources\n", - " project='P93300641', # Input your project ID here\n", - " walltime='2:00:00', # Amount of wall time\n", - " interface='ext', # Interface to use 'lo' provided a cluster window, below.\n", - " )\n", - "\n", - " dask.config.set({\n", - " 'distributed.dashboard.link':\n", - " 'https://jupyterhub.hpc.ucar.edu/stable/user/{USER}/proxy/{port}/status'\n", - " })\n", - "\n", - " client = Client(cluster)\n", - " return cluster, client" - ] - }, - { - "cell_type": "raw", - "id": "e6c2ec6c-628c-4b0a-bb00-a2739422b4d8", - "metadata": {}, - "source": [ - "cluster, client = get_ClusterClient(nmem='1GB')\n", - "cluster.scale(10) \n", - "cluster" - ] - }, { "cell_type": "code", "execution_count": null, @@ -257,30 +212,6 @@ "plt.ylabel(None)\n", "#plt.ylim(6,0)" ] - }, - { - "cell_type": "markdown", - "id": "b3f729af-05b4-4540-b4b5-567cc1cbe8f2", - "metadata": {}, - "source": [ - "### Big blob of passive C with depth in pAD" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c10babf2-4530-4ca9-b304-4db7fb6a965d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a6d508e9-5007-4e9a-9b1f-64a386310644", - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {