Implemented jupyter notebooks for metadata review workflow excecution.

This commit is contained in:
2024-04-04 09:18:36 +02:00
parent 719e9d6672
commit 72e37ed277
2 changed files with 188 additions and 0 deletions

View File

@ -0,0 +1,170 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Import libraries and modules\n",
"\n",
"* Excecute (or Run) Cell"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"root_dir = os.path.abspath(os.curdir)\n",
"sys.path.append(root_dir)\n",
"\n",
"import src.metadata_review_lib as metadata_review_lib"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Step 1: initialize metadata review.\n",
"\n",
"* Specify hdf5 file whose metadata is to be reviewed by editing the string variable `hdf5_file_path`.\n",
"* Edit reviewer attributes, i.e., the dict variable `reviewer_attrs` with your own initials and role.\n",
"* Excecute Cell."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Create branch metadata-review-by-NG\n",
"\n"
]
}
],
"source": [
"\n",
"#hdf5_file_path = \"output_files/unified_file_smog_chamber_2024-03-25_UTC-OFST_+0100_NG.h5\"\n",
"#yml_file_path = \"output_files/unified_file_smog_chamber_2024-03-25_UTC-OFST_+0100_NG.yaml\"\n",
"\n",
"hdf5_file_path = \"output_files/unified_file_smog_chamber_2024-03-25_UTC-OFST_+0100_NG.h5\"\n",
"yml_file_path = \"output_files/unified_file_smog_chamber_2024-03-25_UTC-OFST_+0100_NG.yaml\"\n",
"\n",
"reviewer_attrs = {'initials': 'NG',\n",
" 'type': 'data-owner'}\n",
"\n",
"#output_filename_path, output_yml_filename_path = hdf5_lib.main()\n",
"\n",
"review_yaml_file_path = metadata_review_lib.first_initialize_metadata_review(hdf5_file_path, reviewer_attrs) \n",
"\n",
"print(review_yaml_file_path) "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Step 2: Submit metadata review. \n",
"\n",
"* Edit yaml file in review folder and save changes\n",
"* Excecute Cell."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[data-owner-review-by-NG accb271] Submitted metadata review.\n",
" Committer: Florez Ospina Juan Felipe <juan.florez-ospina@psi.ch>\n",
"Your name and email address were configured automatically based\n",
"on your username and hostname. Please check that they are accurate.\n",
"You can suppress this message by setting them explicitly. Run the\n",
"following command and follow the instructions in your editor to edit\n",
"your configuration file:\n",
"\n",
" git config --global --edit\n",
"\n",
"After doing this, you may fix the identity used for this commit with:\n",
"\n",
" git commit --amend --reset-author\n",
"\n",
" 2 files changed, 3 insertions(+), 3 deletions(-)\n"
]
}
],
"source": [
"metadata_review_lib.second_submit_metadata_review(review_yaml_file_path,reviewer_attrs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Step 3: Update hdf5 file metadata w/ submitted review yaml file.\n",
"\n",
"* Make sure previous step was carried out properly.\n",
"* Excecute Cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"metadata_review_lib.third_update_hdf5_file_with_review(hdf5_file_path, review_yaml_file_path, reviewer_attrs)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Step 4: Complete data-owner review. Update remote repository\n",
"\n",
"* Excecute Cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"metadata_review_lib.fourth_complete_metadata_review(reviewer_attrs)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "test_atmos_chem_env",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@ -0,0 +1,18 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 2
}