Skip to content

Fixes indentation of solution of multiple preprocessors challenge #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2020

Conversation

sverhoeven
Copy link
Contributor

@sverhoeven sverhoeven commented Aug 4, 2020

Pull Request checklist

We appreciate your time and effort to improve the tutorial. Please keep in mind that lesson maintainers are volunteers and it may be some time before they can respond to your contribution.


Before you start

  • Read CONTRIBUTING.md.
  • Create an issue to discuss your idea. This allows your contributions to be incorporated into the tutorial.

Tasks

  • Give this pull request a descriptive title.
  • If you are contributing to existing lesson materials, please make sure the content conforms to the Lesson development section in CONTRIBUTING.md and does not contain any spelling or grammatical errors.
  • If you are making a new episode, please make sure the content conforms to the Lesson organization and Lesson formatting sections in CONTRIBUTING.md and does not contain any spelling or grammatical errors.
  • Preferably Codacy checks pass. Status can be seen below your pull request. If there is an error, click the link to find out why.
  • Preview changes on your machine before pushing them to GitHub by running make serve, alternatively make docker-serve. Please see the Previewing your changes locally section in CONTRIBUTING.md for installation instructions.
  • All code instructions have been tested.

If you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.


Closes {Link to the corresponding issue}

@sverhoeven
Copy link
Contributor Author

Tested by running following recipe

recipe_example_multi_preprocessors.yml
# ESMValTool
# recipe_example.yml
---
documentation:
  description: Demonstrate basic ESMValTool example

  authors:
    - demora_lee
    - mueller_benjamin
    - swaminathan_ranjini

  maintainer:
    - demora_lee

  references:
    - demora2018gmd
    # Some plots also appear in ESMValTool paper 2.

  projects:
    - ukesm

datasets:
  - {dataset: UKESM1-0-LL, project: CMIP6, exp: historical,
     ensemble: r1i1p1f2} #single dataset as an example

preprocessors:
  prep_map:
    regrid:    #apply the preprocessor to regrid
      target_grid: 1x1 # target resolution
      scheme: linear  #how to interpolate for regridding

  prep_map_land:
    custom_order: true #ensure that given order of preprocessing is followed
    mask_landsea:    #apply a mask
      mask_out: sea   #mask out sea grid cells
    regrid:    # now apply the preprocessor to regrid
      target_grid: 1x1 # target resolution
      scheme: linear  #how to interpolate for regridding

diagnostics:
  # --------------------------------------------------
  # Two Simple diagnostics that illustrate the use of
  # different preprocessors
  # --------------------------------------------------
  diag_simple_plot:
    description: # preprocess a variable for a simple 2D plot
    variables:
      tas:  # surface temperature
        preprocessor: prep_map
        mip: Amon
        grid: gn #can change for variables from the same model
        start_year: 1970
        end_year: 2000
    scripts: null

  diag_land_only_plot:
    description: #preprocess a variable for a 2D land only plot
    variables:
      tas:  # surface temperature
        preprocessor: prep_map_land
        mip: Amon
        grid: gn #can change for variables from the same model
        start_year: 1970
        end_year: 2000
    scripts: null

Copy link
Contributor

@Peter9192 Peter9192 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @sverhoeven ,
Very well spotted, I completely agree that the example should be correct. However, there are some other code snippets in the same file where the indentation also seems off (but that are not complete recipes). I think we should fix those as well. E.g.:

    variables:
        timeseries_variable:
        short_name: thetaoga
        preprocessor: prep_timeseries_1

@sverhoeven
Copy link
Contributor Author

In your example the the yaml is still valid.
Fixing all solution of episode 5 is out of scope for this PR.

I would like store the solution recipes for checks in CI and to use the diff view in the Markdown files so I am sure the reader gets correct solution, see #110

@Peter9192
Copy link
Contributor

In your example the the yaml is still valid.

It may be valid but it's good practice to stick to 2 indents, so it should be:

    variables:
      timeseries_variable:
        short_name: thetaoga
        preprocessor: prep_timeseries_1

Fixing all solution of episode 5 is out of scope for this PR.

Then let's open another issue for fixing these, because I do think we should.

@sverhoeven sverhoeven merged commit 99230cb into master Aug 4, 2020
@sverhoeven sverhoeven deleted the ident-recipe-multi-preprocessors-solution branch August 4, 2020 15:55
ehogan pushed a commit to ehogan/ESMValTool_Tutorial that referenced this pull request Nov 21, 2024
…i-preprocessors-solution

Fixes indentation of solution of multiple preprocessors challenge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants