Skip to content
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

Feature 337 xml spec doc #351

Merged
merged 63 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
4c57f59
Delete METreformat/test/eclv_mpr_pct_vl1l2_vcnt.xml
bikegeek Oct 21, 2024
17a1cf2
Delete METreformat/test/ens_stat_ecnt.xml
bikegeek Oct 21, 2024
8a44baf
Delete METreformat/test/mctc_mcts.xml
bikegeek Oct 21, 2024
c987f91
Delete METreformat/test/point_stat.xml
bikegeek Oct 21, 2024
a52eef6
Initial updates for detailed information on loading data.
bikegeek Oct 21, 2024
33b4b59
Initial version-needs cleaning up
bikegeek Oct 21, 2024
7e86f91
Merge branch 'feature_337_xml_spec_doc' of https://github.com/dtcente…
bikegeek Oct 21, 2024
58a559a
increas numbered from 4 to 6
bikegeek Oct 21, 2024
e9244da
Delete docs/Users_Guide/common.rst
bikegeek Oct 21, 2024
1840cb8
remove any links to common.rst
bikegeek Oct 21, 2024
bf9555a
Merge branch 'feature_337_xml_spec_doc' of https://github.com/dtcente…
bikegeek Oct 21, 2024
62d8b67
Work in progress, need to add more content
bikegeek Oct 23, 2024
7b8c092
Merge branch 'develop' of https://github.com/dtcenter/METdataio into …
bikegeek Oct 23, 2024
8e5c8a8
Merge branch 'develop' of https://github.com/dtcenter/METdataio into …
bikegeek Oct 23, 2024
7bfa988
Merge branch 'develop' of https://github.com/dtcenter/METdataio into …
bikegeek Oct 23, 2024
0d977a8
Add example for line_type element
bikegeek Oct 23, 2024
ff2d818
Add checking for the load_files element to the schema
bikegeek Nov 1, 2024
4cea424
Configs for loading specific files
bikegeek Nov 4, 2024
8dc89f4
Merge branch 'develop' of https://github.com/dtcenter/METdataio into …
bikegeek Nov 4, 2024
3c6ec73
additional updates, more are pending. Mostly format changes.
bikegeek Nov 4, 2024
c70cbae
Removed unused content for folder_tmpl information.
bikegeek Nov 4, 2024
8fb4b17
folder_tmpl min occurrence changed to 0 because of load_files support
bikegeek Nov 4, 2024
54a3cd0
Accidentally removed the <verbose> element. Put this back in.
bikegeek Nov 4, 2024
94af151
Added description of flags.
bikegeek Nov 5, 2024
e3e0708
add the valid_times in the folder_tmpl to be consistent with the load…
bikegeek Nov 5, 2024
7dc773a
Changed order of elements for consistency
bikegeek Nov 5, 2024
23f708b
Added content for the load_val/field for config
bikegeek Nov 5, 2024
425464e
Finished content for folder_tmpl
bikegeek Nov 6, 2024
c00e570
Completed instructions/descriptions for generating the XML specificat…
bikegeek Nov 6, 2024
4ba748f
all content added for Background, Create the XMO Specification File, …
bikegeek Nov 6, 2024
486395c
Added instructions for using mv_mysql.sql
bikegeek Nov 6, 2024
c0ab9e2
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
319f1e5
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
cc517ef
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
1c3ba24
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
a6dd022
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
b73bba9
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
8933bcb
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
f84ffd9
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
bbef410
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
5f33758
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
c40d6cb
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
7ae9bbe
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
6c2b019
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
2dd0a66
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
8e451f7
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
3381ee0
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
e9057ab
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
d0dbb3a
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
187247b
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
367fef5
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
ff92e36
Update docs/Users_Guide/load_data.rst
bikegeek Nov 6, 2024
5e24f29
Fixed some formatting/reorganizing and typos
bikegeek Nov 6, 2024
aebdcb6
Replacing <bold>NOTE<bold> with RST syntax
bikegeek Nov 6, 2024
cadd58c
Clean up, move some instructions to the Using METdbLoad secton
bikegeek Nov 7, 2024
853457c
Add a Create Database and Create an XML Load specification Document. …
bikegeek Nov 7, 2024
5792bc4
Fixed formatting, comments that were in the code block are now outsid…
bikegeek Nov 7, 2024
af475e9
lost the last bullet point for the create database section on creatin…
bikegeek Nov 7, 2024
9a5c149
Remove last change, the text was correct
bikegeek Nov 7, 2024
e68d851
Update docs/Users_Guide/load_data.rst
bikegeek Nov 11, 2024
81458e9
Update docs/Users_Guide/load_data.rst
bikegeek Nov 11, 2024
86ecdef
manually modify instructions to indicate path to location of cloned data
bikegeek Nov 11, 2024
627003b
Fixed instructions to use same language as earlier content for consis…
bikegeek Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions METdbLoad/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def mock_logger():
@pytest.fixture
def get_specified_xml_loadfile( ) -> XmlLoadFile:
"""
Retrieve the specified XML load specification filee. This is useful for using different XML
specification file for validating against recursive payloads, large payloads, etc.
Retrieve the specified XML load specification file. This is useful for using different XML
specification file for validating against recursive payloads, large payloads, etc.

Args:
xml_filename: The name of the XML file of interest
Expand Down
10 changes: 5 additions & 5 deletions METdbLoad/docs/Users_Guide/load.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ increase load time.
**<drop_indexes>:** **TRUE** or **FALSE**, this option indicates whether
database indexes should be dropped prior to loading new data.

**<load_indexes>:** **TRUE** or **FALSE**, this option indicates whether
**<apply_indexes>:** **TRUE** or **FALSE**, this option indicates whether
database indexes should be created after loading new data.

**<group>:** The name of the group for the user interface.

**<description>:** A short description of the database.

| **<load_files>:** A list structure containing individual MET output files to load into the database.
|
| **</load_files>:** Follows the list of files after the previous tag, to end the list.
|**<load_files>:** A list structure containing individual MET output files to load into the database.
| **<file>:** Contains a single MET output file to load.
|**</load_files>:** Follows the list of files after the previous tag, to end the list.

| **<file>:** Contains a single MET output file to load.
|

**<folder_tmpl>:** A template string describing the file structure of
the input MET files, which is populated with values specified in
Expand Down
29 changes: 29 additions & 0 deletions METdbLoad/test/Examples/example_load_specific_files.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<load_spec>
<connection>
<host>yourhost:1234</host>
<database>your_database_name</database>
<user>your_db_username</user>
<password>your_password</password>
</connection>

<verbose>true</verbose>
<insert_size>1</insert_size>
<stat_header_db_check>False</stat_header_db_check>
<mode_header_db_check>false</mode_header_db_check>
<drop_indexes>FALSE</drop_indexes>
<apply_indexes>true</apply_indexes>
<load_stat>True</load_stat>
<load_mode>false</load_mode>
<load_mpr>false</load_mpr>
<group>Regional Ensemble</group>

<load_files>
<file>/met_out/mode/mode_MASK_POLY_300000L_20120410_180000V_060000A_cts.txt</file>
<file>/met_out/rhist/ensemble_stat_RRFS_GEFS_GF.SPP.SPPT_RETOP_MRMS_20220507_120000V.stat</file>
</load_files>


<load_xml>true</load_xml>
<load_note>Load MODE and RHIST for load_files.</load_note>

</load_spec>
73 changes: 73 additions & 0 deletions METdbLoad/test/Examples/example_load_specification.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<load_spec>
<connection>
<host>yourhost:1234</host>
<database>your_database_name</database>
<user>your_db_username</user>
<password>your_password</password>
</connection>

<date_list name="folder_dates">
<start>2022050100</start>
<end>2022051200</end>
<inc>86400</inc>
<format>yyyyMMddHH</format>
</date_list>
<date_list name="valid_dates">
<start>2022050100</start>
<end>2022051200</end>
<inc>0600</inc>
<format>yyyyMMddHH</format>
</date_list>

<verbose>false</verbose>
<insert_size>1</insert_size>
<stat_header_db_check>False</stat_header_db_check>
<mode_header_db_check>false</mode_header_db_check>
<drop_indexes>FALSE</drop_indexes>
<apply_indexes>true</apply_indexes>
<load_stat>True</load_stat>
<load_mode>false</load_mode>
<load_mpr>false</load_mpr>
<group>Regional Ensemble</group>

<folder_tmpl>/var/autofs/mnt/hostmachine/projects/RRFS/prototype/met_out/{config}/{fcst_init}/{mem}/{valid_times}/metprd/{met_out}/</folder_tmpl>

<load_val>
<field name="config">
<val>HREF_lag_offset</val>
<val>RTPS</val>
</field>
<field name="fcst_init">
<date_list name="folder_dates"/>
</field>
<field name="mem">
<val>mem01</val>
<val>mem02</val>
<val>mem03</val>
<val>mem04</val>
<val>mem05</val>
<val>mem06</val>
<val>mem07</val>
<val>mem08</val>
<val>mem09</val>
<val>mem10</val>
</field>
<field name="valid_times">
<date_list name="valid_dates"/>
</field>
<field name="met_out">
<val>grid_stat_cmn</val>
<val>point_stat_cmn</val>
</field>
<line_type>
<val>CNT</val>
<val>ORANK</val>
<val>SEEPS_MPR</val>
<val>ME</val>
</line_type>
</load_val>

<load_xml>true</load_xml>
<load_note>Load HREF and RTPS data for Spring 2022.</load_note>

</load_spec>
29 changes: 29 additions & 0 deletions METdbLoad/test/example_load_specific_files.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<load_spec>
<connection>
<host>yourhost:1234</host>
<database>your_database_name</database>
<user>your_db_username</user>
<password>your_password</password>
</connection>

<verbose>true</verbose>
<insert_size>1</insert_size>
<stat_header_db_check>False</stat_header_db_check>
<mode_header_db_check>false</mode_header_db_check>
<drop_indexes>FALSE</drop_indexes>
<apply_indexes>true</apply_indexes>
<load_stat>True</load_stat>
<load_mode>false</load_mode>
<load_mpr>false</load_mpr>
<group>Regional Ensemble</group>

<load_files>
<file>/met_out/mode/mode_MASK_POLY_300000L_20120410_180000V_060000A_cts.txt</file>
<file>/met_out/rhist/ensemble_stat_RRFS_GEFS_GF.SPP.SPPT_RETOP_MRMS_20220507_120000V.stat</file>
</load_files>


<load_xml>true</load_xml>
<load_note>Load MODE and RHIST for load_files.</load_note>

</load_spec>
6 changes: 3 additions & 3 deletions METdbLoad/test/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ def test_tmp_xml(get_specified_xml_loadfile):
f"schema {utils.LOAD_SPECIFICATION_SCHEMA}")
pytest.fail(msg)

@pytest.mark.parametrize("xml_config", ["load_met_gha_prod.xml", "load_met_gha_new.xml"])
@pytest.mark.parametrize("xml_config", ["load_met_gha_prod.xml", "load_met_gha_new.xml", "example_load_specific_files.xml"])
def test_db_xml(get_specified_xml_loadfile, xml_config):
"""
Test validation against an XML specification file that is used in another test that compares two
databases.
Test validation against XML specification files used in another test that compares two
databases and an XML specification file that explicitly lists specific files to load.
ValueError should be NOT be raised for
the load_met_gha_prod/new specification files which are used on real data.
"""
Expand Down
13 changes: 11 additions & 2 deletions METdbLoad/ush/load_specification_schema.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,18 @@

<xs:element type="limitedstringtype" name="group" minOccurs="0"/>
<xs:element type="limitedstringtype" name="description" minOccurs="0"/>
<xs:element type="foldertmpl" name="folder_tmpl"/>

<xs:element name="load_val" minOccurs="1">
<xs:element name="load_files" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="file" minOccurs="1" maxOccurs="200"/>
</xs:sequence>
</xs:complexType>
</xs:element>

<xs:element type="foldertmpl" name="folder_tmpl" minOccurs="0"/>

<xs:element name="load_val" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="field" minOccurs="0" maxOccurs="20">
Expand Down
14 changes: 0 additions & 14 deletions METreformat/test/eclv_mpr_pct_vl1l2_vcnt.xml

This file was deleted.

14 changes: 0 additions & 14 deletions METreformat/test/ens_stat_ecnt.xml

This file was deleted.

14 changes: 0 additions & 14 deletions METreformat/test/mctc_mcts.xml

This file was deleted.

18 changes: 0 additions & 18 deletions METreformat/test/point_stat.xml

This file was deleted.

28 changes: 0 additions & 28 deletions docs/Users_Guide/common.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/Users_Guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ Foundation (NSF).

.. toctree::
:titlesonly:
:numbered: 4
:numbered: 6

overview
release-notes
installation
common
load_data
read_nc
reformat_stat_data



Indices and tables
Expand Down
27 changes: 4 additions & 23 deletions docs/Users_Guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,13 @@ Installation
Download
--------

Download METdataio into an installation directory. Programs can be run from
the ush subdirectory.
Download the latest release:

.. code-block:: ini

git clone https://github.com/dtcenter/METdataio [install]/METdataio
cd [install]/METdataio/METdbLoad/ush
git clone https://github.com/dtcenter/METdataio

Create Database
---------------
.. note::

Data must be loaded into a database which has the prefix \'\mv_\'\,
e.g. mv_met_data. This database must be structured with the METviewer
mv_mysql.sql schema:
Programs can be run from the METdbLoad/ush subdirectory.

.. code-block:: ini

cd [install]/metviewer
mysql -u[db_username] -p[db_password] -e'create database [db_name];'
mysql -u[db_username] -p[db_password] [db_name] < sql/mv_mysql.sql


Create an XML load specification document which contains information about your
MET data. Run METdbload using the XML load specification as input (called
[load_xml] here) and monitor progress:

.. code-block:: ini

python met_db_load.py [load_xml] [optional redirection of output, e.g. &> log/load_[date].log &]'
Loading
Loading