diff --git a/NCARtips.md b/NCARtips.md index 15b6f7d..822f9bf 100644 --- a/NCARtips.md +++ b/NCARtips.md @@ -38,5 +38,5 @@ and can be accessed via the following steps: 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. In the terminal, run `cd ${CUPID_ROOT}/examples/key_metrics/computed_notebooks/_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/README.md b/README.md index 56ca5b9..8be2e31 100644 --- a/README.md +++ b/README.md @@ -53,18 +53,18 @@ please see the [Contributor's Guide](https://ncar.github.io/CUPiD/contributors_g ## Running CUPiD currently provides an example for generating diagnostics. -To test the package out, try to run `examples/coupled-model`: +To test the package out, try to run `examples/key-metrics`: ``` bash $ conda activate cupid-dev -$ cd examples/coupled_model +$ cd examples/key_metrics $ # machine-dependent: request multiple compute cores $ cupid-run $ cupid-build # 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 view `${CUPID_ROOT}/examples/coupled-model/computed_notebooks/quick-run/_build/html/index.html` in a web browser. +After the last step is finished, you can use Jupyter to view generated notebooks in `${CUPID_ROOT}/examples/key-metrics/computed_notebooks` +or you can view `${CUPID_ROOT}/examples/key-metrics/computed_notebooks/_build/html/index.html` in a web browser. Notes: diff --git a/cupid/build.py b/cupid/build.py index 21fe6ee..f5a4bf3 100755 --- a/cupid/build.py +++ b/cupid/build.py @@ -39,12 +39,11 @@ def build(config_path): with open(config_path) as fid: control = yaml.safe_load(fid) - sname = control["data_sources"]["sname"] run_dir = control["data_sources"]["run_dir"] - subprocess.run(["jupyter-book", "clean", f"{run_dir}/computed_notebooks/{sname}"]) + subprocess.run(["jupyter-book", "clean", f"{run_dir}/computed_notebooks"]) subprocess.run( - ["jupyter-book", "build", f"{run_dir}/computed_notebooks/{sname}", "--all"], + ["jupyter-book", "build", f"{run_dir}/computed_notebooks", "--all"], ) for component in control["compute_notebooks"]: for notebook in control["compute_notebooks"][component]: @@ -57,7 +56,7 @@ def build(config_path): ): shutil.copytree( f"{run_dir}/ADF_output", - f"{run_dir}/computed_notebooks/{sname}/_build/html/ADF", + f"{run_dir}/computed_notebooks/_build/html/ADF", ) # Originally used this code to copy jupyter book HTML to a location to host it online @@ -69,7 +68,7 @@ def build(config_path): # remote_dir = control["publish_location"]["remote_dir"] # this seems more complicated than expected...people have mentioned paramiko library? # subprocess.run(["mkdir", "-p", remote_dir]) - # subprocess.run(["scp", "-r", f"{run_dir}/computed_notebooks/{sname}/_build/html/*", + # subprocess.run(["scp", "-r", f"{run_dir}/computed_notebooks/_build/html/*", # f"{user}@{remote_mach}:{remote_dir}"]) return None diff --git a/cupid/run.py b/cupid/run.py index d791669..8ed31a0 100755 --- a/cupid/run.py +++ b/cupid/run.py @@ -192,7 +192,7 @@ def run( # Grab paths run_dir = os.path.realpath(os.path.expanduser(control["data_sources"]["run_dir"])) - output_dir = run_dir + "/computed_notebooks/" + control["data_sources"]["sname"] + output_dir = run_dir + "/computed_notebooks/" temp_data_path = run_dir + "/temp_data" nb_path_root = os.path.realpath( os.path.expanduser(control["data_sources"]["nb_path_root"]), diff --git a/cupid/util.py b/cupid/util.py index 851303e..26044ae 100644 --- a/cupid/util.py +++ b/cupid/util.py @@ -141,7 +141,7 @@ def setup_book(config_path): os.makedirs(output_root, exist_ok=True) - output_dir = f'{output_root}/{control["data_sources"]["sname"]}' + output_dir = f"{output_root}" os.makedirs(output_dir, exist_ok=True) diff --git a/docs/addingnotebookstocollection.md b/docs/addingnotebookstocollection.md index 9ef0a4b..1369a08 100644 --- a/docs/addingnotebookstocollection.md +++ b/docs/addingnotebookstocollection.md @@ -6,7 +6,6 @@ Generally, a good fit for a diagnostic notebook is one that reads in CESM output 1. Install the `environments/cupid-analysis.yml` environment (see [installation instructions](https://ncar.github.io/CUPiD/index.html#installing)). Make sure that your notebook runs properly in this environment. If there are conflicts or missing dependencies, open an issue or talk to CUPiD developers so we can find a solution. 2. In your notebook, move all variables you might want to change (paths to data, dates to select, etc.) to a cell near the top. For example: - sname = "run_name" data_path = "path/to/data" dates = {"start_date" = "01/01/01", "end_date" = "01/01/02"} @@ -15,7 +14,7 @@ Generally, a good fit for a diagnostic notebook is one that reads in CESM output --- **If you want to run your notebook through the `CUPiD` workflow yourself, follow the rest of the instructions:** -4. Move your new diagnostic notebook to the folder called `examples/nblibrary`. +4. Move your new diagnostic notebook to the folder called `nblibrary`. 5. Open `config.yml`. First, add your new notebook (as its name, minus the `.ipynb`) to the list of notebooks that will be computed (`compute_notebooks`). The notebooks will be executed in the order they are listed here. For example: diff --git a/docs/config.md b/docs/config.md index 07290f5..4dc3bec 100644 --- a/docs/config.md +++ b/docs/config.md @@ -5,8 +5,6 @@ This page describes the fields in the configuration file that might commonly be CUPiD Config 1 The data sources section of the configuration file describes general data sources and expected directory structure for running CUPiD. -`sname`: nickname for this configuration as a string. This will be used as the name of the folder your computed notebooks are put in - CUPiD Config 2 The computation config section of the configuration file supplies the default kernel for running CUPiD. This should usually be `cupid-analysis`. If a contributor wants to include additional packages, please create an issue describing the packages you'd like to add to this conda environment. diff --git a/examples/coupled_model/config.yml b/examples/coupled_model/config.yml index ac3e83a..b8e1380 100644 --- a/examples/coupled_model/config.yml +++ b/examples/coupled_model/config.yml @@ -4,10 +4,6 @@ # Data Sources # ################ data_sources: - # sname is any string used as a nickname for this configuration. It will be - ### used as the name of the folder your computed notebooks are put in - sname: quick-run - # run_dir is the path to the folder you want ### all the files associated with this configuration ### to be created in @@ -17,7 +13,7 @@ data_sources: ### look for your template notebooks in. It doesn't have to ### be inside run_dir, or be specific to this project, as ### long as the notebooks are there - nb_path_root: ../nblibrary + nb_path_root: ../../nblibrary ###################### # Computation Config # diff --git a/examples/external_diag_packages/config.yml b/examples/external_diag_packages/config.yml index a9d7327..56a9ed4 100644 --- a/examples/external_diag_packages/config.yml +++ b/examples/external_diag_packages/config.yml @@ -4,10 +4,6 @@ # Data Sources # ################ data_sources: - # sname is any string used as a nickname for this configuration. It will be - ### used as the name of the folder your computed notebooks are put in - sname: external_diag_packages - # run_dir is the path to the folder you want ### all the files associated with this configuration ### to be created in @@ -17,7 +13,7 @@ data_sources: ### look for your template notebooks in. It doesn't have to ### be inside run_dir, or be specific to this project, as ### long as the notebooks are there - nb_path_root: ../nblibrary + nb_path_root: ../../nblibrary ###################### # Computation Config # @@ -118,7 +114,7 @@ compute_notebooks: kernel_name: cupid-dev parameter_groups: none: - adf_root: ../../external_diag_packages/ADF/ + adf_root: ../../examples/external_diag_packages/ADF_output/ case_year_range: "1_100" base_case_year_range: "1995_2006" external_tool: diff --git a/examples/key_metrics/config.yml b/examples/key_metrics/config.yml index d6eb0a3..7efb2a7 100644 --- a/examples/key_metrics/config.yml +++ b/examples/key_metrics/config.yml @@ -4,10 +4,6 @@ # Data Sources # ################ data_sources: - # sname is any string used as a nickname for this configuration. It will be - ### used as the name of the folder your computed notebooks are put in - sname: key_metrics - # run_dir is the path to the folder you want ### all the files associated with this configuration ### to be created in @@ -17,7 +13,7 @@ data_sources: ### look for your template notebooks in. It doesn't have to ### be inside run_dir, or be specific to this project, as ### long as the notebooks are there - nb_path_root: ../nblibrary + nb_path_root: ../../nblibrary ###################### # Computation Config # @@ -129,23 +125,23 @@ compute_notebooks: obs_name: 'GrIS_MARv3.12_climo_1960_1999.nc' climo_nyears: 40 - rof: - global_discharge_gauge_compare_obs: - parameter_groups: - none: - analysis_name: "" - grid_name: 'f09_f09_mosart' # ROF grid name - rof_start_date: '0091-01-01' - rof_end_date: '0101-01-01' - figureSave: False - global_discharge_ocean_compare_obs: - parameter_groups: - none: - analysis_name: "" - grid_name: 'f09_f09_mosart' # ROF grid name - rof_start_date: '0091-01-01' - rof_end_date: '0101-01-01' - figureSave: False +# rof: +# global_discharge_gauge_compare_obs: +# parameter_groups: +# none: +# analysis_name: "" +# grid_name: 'f09_f09_mosart' # ROF grid name +# rof_start_date: '0091-01-01' +# rof_end_date: '0101-01-01' +# figureSave: False +# global_discharge_ocean_compare_obs: +# parameter_groups: +# none: +# analysis_name: "" +# grid_name: 'f09_f09_mosart' # ROF grid name +# rof_start_date: '0091-01-01' +# rof_end_date: '0101-01-01' +# figureSave: False # ice: # seaice: diff --git a/helper_scripts/generate_adf_config_file.py b/helper_scripts/generate_adf_config_file.py index 810ebf9..ddecaba 100755 --- a/helper_scripts/generate_adf_config_file.py +++ b/helper_scripts/generate_adf_config_file.py @@ -58,7 +58,7 @@ def generate_adf_config(cesm_root, cupid_example, adf_file, out_file): valid_examples = [ example for example in next(os.walk(cupid_examples))[1] - if example not in ["ilamb", "nblibrary"] + if example not in ["ilamb"] ] if cupid_example not in valid_examples: error_msg = f"argument --cupid-example: invalid choice '{cupid_example}'" diff --git a/helper_scripts/generate_cupid_config_for_cesm_case.py b/helper_scripts/generate_cupid_config_for_cesm_case.py index 4edb075..74edfce 100755 --- a/helper_scripts/generate_cupid_config_for_cesm_case.py +++ b/helper_scripts/generate_cupid_config_for_cesm_case.py @@ -95,7 +95,7 @@ def generate_cupid_config(case_root, cesm_root, cupid_example): valid_examples = [ example for example in next(os.walk(cupid_examples))[1] - if example not in ["ilamb", "nblibrary"] + if example not in ["ilamb"] ] if cupid_example not in valid_examples: error_msg = f"argument --cupid-example: invalid choice '{cupid_example}'" diff --git a/examples/nblibrary/.gitignore b/nblibrary/.gitignore similarity index 100% rename from examples/nblibrary/.gitignore rename to nblibrary/.gitignore diff --git a/examples/nblibrary/atm/Global_PSL_NMSE_compare_obs_lens.ipynb b/nblibrary/atm/Global_PSL_NMSE_compare_obs_lens.ipynb similarity index 100% rename from examples/nblibrary/atm/Global_PSL_NMSE_compare_obs_lens.ipynb rename to nblibrary/atm/Global_PSL_NMSE_compare_obs_lens.ipynb diff --git a/examples/nblibrary/atm/adf_quick_run.ipynb b/nblibrary/atm/adf_quick_run.ipynb similarity index 100% rename from examples/nblibrary/atm/adf_quick_run.ipynb rename to nblibrary/atm/adf_quick_run.ipynb diff --git a/examples/nblibrary/atm/averaging_utils.py b/nblibrary/atm/averaging_utils.py similarity index 100% rename from examples/nblibrary/atm/averaging_utils.py rename to nblibrary/atm/averaging_utils.py diff --git a/examples/nblibrary/atm/config_f.cam6_3_119.FLTHIST_ne30.r328_gamma0.33_soae.001.yaml b/nblibrary/atm/config_f.cam6_3_119.FLTHIST_ne30.r328_gamma0.33_soae.001.yaml similarity index 100% rename from examples/nblibrary/atm/config_f.cam6_3_119.FLTHIST_ne30.r328_gamma0.33_soae.001.yaml rename to nblibrary/atm/config_f.cam6_3_119.FLTHIST_ne30.r328_gamma0.33_soae.001.yaml diff --git a/examples/nblibrary/atm/link_to_ADF.ipynb b/nblibrary/atm/link_to_ADF.ipynb similarity index 99% rename from examples/nblibrary/atm/link_to_ADF.ipynb rename to nblibrary/atm/link_to_ADF.ipynb index 3e6e3fb..75adc48 100644 --- a/examples/nblibrary/atm/link_to_ADF.ipynb +++ b/nblibrary/atm/link_to_ADF.ipynb @@ -61,7 +61,7 @@ "base_case_name = None\n", "case_year_range = None\n", "base_case_year_range = None\n", - "# adf_root will be external_diag_packages/computed_notebooks/external_diag_packages/ADF/" + "# adf_root will be external_diag_packages/computed_notebooks/ADF/" ] }, { diff --git a/examples/nblibrary/atm/nmse_utils.py b/nblibrary/atm/nmse_utils.py similarity index 100% rename from examples/nblibrary/atm/nmse_utils.py rename to nblibrary/atm/nmse_utils.py diff --git a/examples/nblibrary/glc/Greenland_SMB_visual_compare_obs.ipynb b/nblibrary/glc/Greenland_SMB_visual_compare_obs.ipynb similarity index 100% rename from examples/nblibrary/glc/Greenland_SMB_visual_compare_obs.ipynb rename to nblibrary/glc/Greenland_SMB_visual_compare_obs.ipynb diff --git a/examples/nblibrary/glc/utils.py b/nblibrary/glc/utils.py similarity index 100% rename from examples/nblibrary/glc/utils.py rename to nblibrary/glc/utils.py diff --git a/examples/nblibrary/ice/cice_masks.yml b/nblibrary/ice/cice_masks.yml similarity index 100% rename from examples/nblibrary/ice/cice_masks.yml rename to nblibrary/ice/cice_masks.yml diff --git a/examples/nblibrary/ice/cice_vars.yml b/nblibrary/ice/cice_vars.yml similarity index 100% rename from examples/nblibrary/ice/cice_vars.yml rename to nblibrary/ice/cice_vars.yml diff --git a/examples/nblibrary/ice/plot_diff.py b/nblibrary/ice/plot_diff.py similarity index 100% rename from examples/nblibrary/ice/plot_diff.py rename to nblibrary/ice/plot_diff.py diff --git a/examples/nblibrary/ice/seaice.ipynb b/nblibrary/ice/seaice.ipynb similarity index 100% rename from examples/nblibrary/ice/seaice.ipynb rename to nblibrary/ice/seaice.ipynb diff --git a/examples/nblibrary/ice/vect_diff.py b/nblibrary/ice/vect_diff.py similarity index 100% rename from examples/nblibrary/ice/vect_diff.py rename to nblibrary/ice/vect_diff.py diff --git a/examples/nblibrary/infrastructure/index.ipynb b/nblibrary/infrastructure/index.ipynb similarity index 100% rename from examples/nblibrary/infrastructure/index.ipynb rename to nblibrary/infrastructure/index.ipynb diff --git a/examples/nblibrary/lnd/Global_TerrestrialCouplingIndex_VisualCompareObs.ipynb b/nblibrary/lnd/Global_TerrestrialCouplingIndex_VisualCompareObs.ipynb similarity index 100% rename from examples/nblibrary/lnd/Global_TerrestrialCouplingIndex_VisualCompareObs.ipynb rename to nblibrary/lnd/Global_TerrestrialCouplingIndex_VisualCompareObs.ipynb diff --git a/examples/nblibrary/lnd/land_comparison.ipynb b/nblibrary/lnd/land_comparison.ipynb similarity index 100% rename from examples/nblibrary/lnd/land_comparison.ipynb rename to nblibrary/lnd/land_comparison.ipynb diff --git a/examples/nblibrary/ocn/ocean_surface.ipynb b/nblibrary/ocn/ocean_surface.ipynb similarity index 100% rename from examples/nblibrary/ocn/ocean_surface.ipynb rename to nblibrary/ocn/ocean_surface.ipynb diff --git a/examples/nblibrary/rof/global_discharge_gauge_compare_obs.ipynb b/nblibrary/rof/global_discharge_gauge_compare_obs.ipynb similarity index 100% rename from examples/nblibrary/rof/global_discharge_gauge_compare_obs.ipynb rename to nblibrary/rof/global_discharge_gauge_compare_obs.ipynb diff --git a/examples/nblibrary/rof/global_discharge_ocean_compare_obs.ipynb b/nblibrary/rof/global_discharge_ocean_compare_obs.ipynb similarity index 100% rename from examples/nblibrary/rof/global_discharge_ocean_compare_obs.ipynb rename to nblibrary/rof/global_discharge_ocean_compare_obs.ipynb diff --git a/examples/nblibrary/rof/scripts/colors.py b/nblibrary/rof/scripts/colors.py similarity index 100% rename from examples/nblibrary/rof/scripts/colors.py rename to nblibrary/rof/scripts/colors.py diff --git a/examples/nblibrary/rof/scripts/metrics.py b/nblibrary/rof/scripts/metrics.py similarity index 100% rename from examples/nblibrary/rof/scripts/metrics.py rename to nblibrary/rof/scripts/metrics.py diff --git a/examples/nblibrary/rof/scripts/utility.py b/nblibrary/rof/scripts/utility.py similarity index 100% rename from examples/nblibrary/rof/scripts/utility.py rename to nblibrary/rof/scripts/utility.py diff --git a/examples/nblibrary/rof/setup/large_river_50.txt b/nblibrary/rof/setup/large_river_50.txt similarity index 100% rename from examples/nblibrary/rof/setup/large_river_50.txt rename to nblibrary/rof/setup/large_river_50.txt diff --git a/examples/nblibrary/rof/setup/setup.yaml b/nblibrary/rof/setup/setup.yaml similarity index 100% rename from examples/nblibrary/rof/setup/setup.yaml rename to nblibrary/rof/setup/setup.yaml