Skip to content

Commit 0abe438

Browse files
committed
Finalize episode resturcturing
1 parent 49c7d14 commit 0abe438

File tree

1 file changed

+37
-236
lines changed

1 file changed

+37
-236
lines changed

_episodes/09-cmorization.md

Lines changed: 37 additions & 236 deletions
Original file line numberDiff line numberDiff line change
@@ -673,34 +673,21 @@ we're updating the cubes metadata to conform to the CMOR table.
673673
674674
Finally, the test recipe should run without errors or warnings.
675675
676-
## QUESTION: why is there no warning/error about the latitude direction. Should we not have to flip it?
677-
678676
### 4. Finalizing the CMORizer
679677
680678
Once everything works as expected, there's a couple of things that we can still do.
681679
682-
- Add header info
683-
- Make sure the metadata are added to the config file
684-
- Maybe go through a checklist????
685-
- add an entry to config-references?
686-
- Add additional cmorizer step:
687-
688-
```python
689-
# 2d. Update the cubes metadata with all info from the config file
690-
utils.set_global_atts(cube, attributes)
691-
```
692-
693-
694-
The header contains information about where to obtain the data, when it was
695-
accessed the last time, which ESMValTool "tier" it is associated with, and more
696-
detailed information about the necessary downloading and processing steps.
680+
- **Add download instructions**. The header of the CMORizer contains information about
681+
where to obtain the data, when it was accessed the last time, which ESMValTool
682+
"tier" it is associated with, and more detailed information about the
683+
necessary downloading and processing steps.
697684
698685
> ## Fill out the header for the "FLUXCOM" dataset
699686
>
700-
> Fill out the information that is necessary in the header of a CMORizing
701-
> script for the dataset "FLUXCOM". The different parts that need to be
687+
> Fill out the header of the new CMORizer. The different parts that need to be
702688
> present in the header are the following:
703-
> - caption: " """ESMValTool CMORizer for FLUXCOM GPP data."
689+
>
690+
> - Caption: the first line of the docstring should summarize what the script does.
704691
> - Tier
705692
> - Source
706693
> - Last access
@@ -738,234 +725,48 @@ detailed information about the necessary downloading and processing steps.
738725
> > version 2.3.0 Aug 2019
739726
> > """
740727
> > ```
741-
> >
742-
> > This is the header of the "FLUXCOM" CMORizer that is available with the
743-
> > ESMValTool already. It is therefore entirely possible that your entries for
744-
> > the section "Last access" and "Download and processing instructions"
745-
> > differ from the example here since the entries for these sections are
746-
> > somewhat subjective.
747-
> >
748728
> {: .solution}
749729
{: .challenge}
750730
751731
732+
- **Complete the metadata in the config file**. We have left a few fields empty
733+
in the configuration file, such as 'source'. By filling out these fields we can
734+
make sure the relevant metadata is passed on as attributes in the CMORized
735+
data. To make this work, add the following line to the CMORizer script:
752736
737+
```python
738+
# 2d. Update the cubes metadata with all info from the config file
739+
utils.set_global_atts(cube, attributes)
740+
```
753741
742+
- **Add a reference**. Make sure that there is a reference file available for
743+
the dataset. You can add a [BibTeX info
744+
file](https://github.com/ESMValGroup/ESMValTool/tree/master/esmvaltool/references)
745+
here.
754746
747+
- **Make a pull request**. Since you have gone through all the trouble to
748+
reformat the dataset so that the ESMValTool can work with it, it would be
749+
great if you could provide the CMORizer, and ultimately with that the dataset,
750+
to the rest of the community. For more information, see the previous episode
751+
on [Contributing to ESMValTool](/08-development-setup).
755752
753+
- **Add documentation**. Make sure that you have added the info of your dataset
754+
to the User Guide so that people know it is available for the ESMValTool
755+
[Obtaining input
756+
data](https://github.com/ESMValGroup/ESMValTool/blob/master/doc/sphinx/source/input.rst).
756757
757758
758-
759-
760-
761-
762-
763-
764-
765-
To make sure that the CMORization has really worked as planned, we run the
766-
CMOR checker on this newly produced NetCDF file. If the ESMValTool can read
767-
the data without problems, you should see as one of the last lines of
768-
ESMValTool output:
769-
770-
```bash
771-
INFO Run was successful
772-
```
773-
774-
## Last steps
775-
776-
Congratulations! You have successfully CMORized a new dataset!
777-
Since you have gone through all the trouble to reformat the dataset so that
778-
the ESMValTool can work with it, it would be great if you could provide the
779-
CMORizer, and ultimately with that the dataset, to the rest of the community.
780-
To do that there are a few more steps you have to do:
781-
1. Check out the previous episode on [Contributing to ESMValTool](/08-development-setup)
782-
1. Make sure that you have added the info of your dataset to the User Guide so
783-
that people know it is available for the ESMValTool [Obtaining input
784-
data](https://github.com/ESMValGroup/ESMValTool/blob/master/doc/sphinx/source/input.rst)
785-
1. Make sure that there is a reference file available for the dataset [BibTeX
786-
info
787-
file](https://github.com/ESMValGroup/ESMValTool/tree/master/esmvaltool/references)
788-
789759
## Some final comments
790760
791-
Adding a new CMORizer to the ESMValTool is definitely already an advanced task
792-
when working with the ESMValTool. You need to have a basic understanding of
793-
how the ESMValTool works and how it's internal structure looks like. In
794-
addition, you need to have a basic understanding of NetCDF files and a
795-
programming language. In our example we used python for the CMORizing script
796-
since we advocate for focusing the code development on only a few different
797-
programming languages. This helps to maintain the code and to ensure the
798-
compatibility of the code with possible fundamental changes to the structure
799-
of the ESMValTool and ESMValCore.
761+
Congratulations! You have just added support for a new dataset to ESMValTool!
762+
Adding a new CMORizer is definitely already an advanced task when working with
763+
the ESMValTool. You need to have a basic understanding of how the ESMValTool
764+
works and how it's internal structure looks like. In addition, you need to have
765+
a basic understanding of NetCDF files and a programming language. In our example
766+
we used python for the CMORizing script since we advocate for focusing the code
767+
development on only a few different programming languages. This helps to
768+
maintain the code and to ensure the compatibility of the code with possible
769+
fundamental changes to the structure of the ESMValTool and ESMValCore.
800770
801771
More information about adding observations to the ESMValTool can be found in the
802772
[documentation](https://docs.esmvaltool.org/en/latest/input.html#observations).
803-
804-
805-
806-
807-
808-
809-
810-
811-
812-
<!-- ## Check if your variable is following the CMOR standard / Check if it's in a CMOR table
813-
814-
The very first step we have to do is to check if your data file follows the CMOR standard.
815-
Only data files that fully follow this standard can be read by the ESMValTool.
816-
817-
Most variables that we would want to use with the ESMValTool are defined in the Coupled
818-
Model Intercomparison Project (CMIP) data request and can be found in the
819-
CMOR tables in the folder
820-
[cmip6/Tables](https://github.com/ESMValGroup/ESMValCore/tree/master/esmvalcore/cmor/tables/cmip6/Tables),
821-
differentiated according to the "MIP" they belong to. The tables are a
822-
copy of the [PCMDI](https://github.com/PCMDI) guidelines.
823-
824-
> ## Find the variable "gpp" in a CMOR table
825-
>
826-
> Check the available CMOR tables to find the variable "gpp" with the following characteristics:
827-
> - standard_name: ``gross_primary_productivity_of_biomass_expressed_as_carbon``
828-
> - frequency: ``mon``
829-
> - modeling_realm: ``land``
830-
>
831-
> > ## Answers
832-
> >
833-
> > The variable "gpp" belongs to the land variables. The temporal resolution that we are looking
834-
> > for is "monthly". This information points to the "Lmon" CMIP table. And indeed, the variable
835-
> > "gpp" can be found in the file
836-
> > [here](https://github.com/ESMValGroup/ESMValCore/blob/master/esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Lmon.json).
837-
> >
838-
> {: .solution}
839-
{: .challenge}
840-
841-
842-
If the variable you are interested in is not available in the standard CMOR
843-
tables, you need to write a custom CMOR table entry for the variable. Examples
844-
of custom CMOR table entries are for example the standard error of a specific
845-
variable. For our variable "gpp" there is indeed no CMOR definition for the
846-
standard error, therefore "gppStderr" was defined in the custom CMOR table
847-
[here](https://github.com/ESMValGroup/ESMValCore/tree/master/esmvalcore/cmor/tables/custom),
848-
as ``CMOR_gppStderr.dat``.
849-
850-
To create a new custom CMOR table you need to follow these
851-
guidelines:
852-
853-
- Provide the ``variable_entry``;
854-
- Provide the ``modeling_realm``;
855-
- Provide the variable attributes, but leave ``standard_name`` blank. Necessary
856-
variable attributes are: ``units``, ``cell_methods``, ``cell_measures``,
857-
``long_name``, ``comment``.
858-
- Provide some additional variable attributes. Necessary additional variable
859-
attributes are: ``dimensions``, ``out_name``, ``type``. There are also
860-
additional variable attributes that can be defined here (see the already
861-
available cmorizers).
862-
863-
It is easiest to start a new custom CMOR table by using an existing custom table
864-
as a template.
865-
You can then edit the content and save it as ``CMOR_<short_name>.dat``.
866-
867-
> ## Does the variable "cVegStderr" need a costum CMOR table?
868-
>
869-
> Check the available CMOR tables to find the variable "cVegStderr" with the
870-
> following characteristics:
871-
> - standard_name: ``vegetation_carbon_content``
872-
> - frequency: ``mon``
873-
> - modeling_realm: ``land``
874-
>
875-
> If it is not available, create a custom CMOR table following the template of
876-
> the CMIP6 CMOR table of "cVeg" and custom CMOR table of "gppStderr".
877-
>
878-
> > ## Answers
879-
> >
880-
> > The first step here is to check if the variable "cVegStderr" is already
881-
> > listed in a CMOR table. We have the information that the modeling_realm
882-
> > of the variable is ``land`` and that the frequency is ``mon``. This
883-
> > means we have to check the CMOR table "Lmon" for an entry. We focus
884-
> > our search on the CMIP6 tables since these are the most recent tables
885-
> > available. You can find the lists here:
886-
> > `<https://github.com/ESMValGroup/ESMValCore/tree/master/esmvalcore/cmor/tables/cmip6/Tables>`
887-
> >
888-
> > We do not find the variable "cVegStderr" in the "Lmon" table, which
889-
> > means we will have to write our own custom table for this.
890-
> > There were two examples given which we could use as templates for the
891-
> > new custom table that we have to create. These two examples can be
892-
> > found here: [cVeg](https://github.com/ESMValGroup/ESMValCore/blob/master/esmvalcore/cmor/tables/cmip6/Tables/CMIP6_Lmon.json)
893-
> > and [gppStderr](https://github.com/ESMValGroup/ESMValCore/blob/master/esmvalcore/cmor/tables/custom/CMOR_gppStderr.dat)
894-
> >
895-
> > We have to create a new file with the name ``CMOR_cVegStrerr.dat`` in
896-
> > the custom CMOR table folder (https://github.com/ESMValGroup/ESMValCore/blob/master/esmvalcore/cmor/tables/custom/).
897-
> > The content of the file should then look like this:
898-
> >
899-
> > ```
900-
> > SOURCE: CMIP6
901-
> > !============
902-
> > variable_entry: cVegStderr
903-
> > !============
904-
> > modeling_realm: land
905-
> > !----------------------------------
906-
> > ! Variable attributes:
907-
> > !----------------------------------
908-
> > standard_name:
909-
> > units: kg m-2
910-
> > cell_methods: area: mean where land time: mean
911-
> > cell_measures: area: areacella
912-
> > long_name: Carbon Mass in Vegetation Error
913-
> > !----------------------------------
914-
> > ! Additional variable information:
915-
> > !----------------------------------
916-
> > dimensions: longitude latitude time
917-
> > out_name: cVegStderr
918-
> > type: real
919-
> > !----------------------------------
920-
> > !
921-
> > ```
922-
> >
923-
> > Note that there is no entry for ``standard_name``. This is on purpose.
924-
> > It is a sign for the ESMValTool to not crash although the variable that
925-
> > we are looking for is ok to have no official CMIP6 ``standard_name``.
926-
> >
927-
> {: .solution}
928-
{: .challenge} -->
929-
930-
931-
932-
<!-- > > *Suggestion: maybe add the reference under step 3 (additional but not strictly necessary steps)*
933-
> > Note the attribute "reference" here: it should include a ``doi`` related to
934-
> > the dataset. For more information on how to add references to the
935-
> > ``reference`` section of the configuration file, see the section in the
936-
> > documentation about this: [adding
937-
> > references](https://docs.esmvaltool.org/en/latest/community/diagnostic.html#adding-references) -->
938-
939-
940-
941-
942-
<!--
943-
> > ## Answers
944-
> >
945-
> > The configuration file for the "FLUXCOM" dataset with all necessary pieces
946-
> > of information looks like this:
947-
> >
948-
> > ```yaml
949-
> > ---
950-
> > # Filename
951-
> > filename: 'GPP.ANN.CRUNCEPv6.monthly.*.nc'
952-
> >
953-
> > # Common global attributes for Cmorizer output
954-
> > attributes:
955-
> > project_id: OBS
956-
> > dataset_id: FLUXCOM
957-
> > version: 'ANN-v1'
958-
> > tier: 3
959-
> > modeling_realm: reanaly
960-
> > source: 'http://www.bgc-jena.mpg.de/geodb/BGI/Home'
961-
> > reference: 'fluxcom'
962-
> > comment: ''
963-
> >
964-
> > # Variables to cmorize
965-
> > variables:
966-
> > gpp:
967-
> > mip: Lmon
968-
> > ```
969-
> >
970-
> {: .solution}
971-
{: .challenge} -->

0 commit comments

Comments
 (0)