Created
April 18, 2018 20:37
-
-
Save ColinTalbert/eba877b74fb70b22310f936e9daaad46 to your computer and use it in GitHub Desktop.
Update publication date in metadata.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import json\n", | |
"\n", | |
"import pysb\n", | |
"import getpass\n", | |
"\n", | |
"from pymdwizard.core import xml_utils\n", | |
"from pymdwizard.core.xml_utils import XMLRecord, XMLNode\n", | |
"# from pymdwizard.core.datacite import get_doi_citation\n", | |
"from pymdwizard.core.doi_utils import get_doi_citation\n", | |
"\n", | |
"import warnings\n", | |
"warnings.filterwarnings('ignore')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"fname = r\"C:\\Users\\talbertc\\Downloads\\Cumulative_Compaction_of_Subsurface_Sediments_2017_metadata.xml\"" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"md = XMLRecord(fname)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<citeinfo>\n", | |
" <origin>Sachin D. Shah</origin>\n", | |
" <origin>Jason K. Ramage</origin>\n", | |
" <pubdate>2018</pubdate>\n", | |
" <title>testing</title>\n", | |
" <geoform>txt</geoform>\n", | |
" <pubinfo>\n", | |
" <pubplace>Austin, TX</pubplace>\n", | |
" <publish>U.S. Geological Survey</publish>\n", | |
" </pubinfo>\n", | |
" <onlink>https://doi.org/10.5066/F7D799Q9</onlink>\n", | |
"</citeinfo>" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"md.metadata.idinfo.citation.citeinfo" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"del md.metadata.idinfo.citation.citeinfo.children[2]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<citeinfo>\n", | |
" <origin>Sachin D. Shah</origin>\n", | |
" <origin>Jason K. Ramage</origin>\n", | |
" <title>testing</title>\n", | |
" <geoform>txt</geoform>\n", | |
" <pubinfo>\n", | |
" <pubplace>Austin, TX</pubplace>\n", | |
" <publish>U.S. Geological Survey</publish>\n", | |
" </pubinfo>\n", | |
" <onlink>https://doi.org/10.5066/F7D799Q9</onlink>\n", | |
"</citeinfo>" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"md.metadata.idinfo.citation.citeinfo" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"pubdate = XMLNode(tag='pubdate', text='1234')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"md.metadata.idinfo.citation.citeinfo.add_child(pubdate, index=2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<citeinfo>\n", | |
" <origin>Sachin D. Shah</origin>\n", | |
" <origin>Jason K. Ramage</origin>\n", | |
" <pubdate>1234</pubdate>\n", | |
" <title>testing</title>\n", | |
" <geoform>txt</geoform>\n", | |
" <pubinfo>\n", | |
" <pubplace>Austin, TX</pubplace>\n", | |
" <publish>U.S. Geological Survey</publish>\n", | |
" </pubinfo>\n", | |
" <onlink>https://doi.org/10.5066/F7D799Q9</onlink>\n", | |
"</citeinfo>" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"md.metadata.idinfo.citation.citeinfo" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"anaconda-cloud": {}, | |
"kernelspec": { | |
"display_name": "Python [default]", | |
"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.5.3" | |
}, | |
"toc": { | |
"nav_menu": {}, | |
"number_sections": true, | |
"sideBar": true, | |
"skip_h1_title": false, | |
"title_cell": "Table of Contents", | |
"title_sidebar": "Contents", | |
"toc_cell": false, | |
"toc_position": {}, | |
"toc_section_display": true, | |
"toc_window_display": false | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment