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

Version 1.2 #152

Merged
merged 205 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
6ca2290
Add StationXML-1.0to1.1.xslt and section to README
Apr 8, 2020
d00fd4c
Add more details to conversion section of README
Apr 8, 2020
89f5033
Add comprehensive specification documentation (#30)
Sep 28, 2020
8c64274
change Example: text to <example> subelement as annotation is lax
crotwell Jul 14, 2021
844ec5e
process <example> subelements in annotations
crotwell Jul 14, 2021
e513af3
choiceChooser was never actually used
crotwell Jul 14, 2021
fa1a349
LevelChoice as attr for examples
crotwell Jul 14, 2021
3cb9632
attribute examples as <example>
crotwell Jul 14, 2021
ae8029c
remove old style example loading
crotwell Jul 14, 2021
859fa02
make Warning: into <warning> element
crotwell Jul 14, 2021
51a34c6
ElementChoice as attrib of example
crotwell Jul 14, 2021
5538b01
LevelChoice as attribute on <example> and <levelDesc>
crotwell Jul 14, 2021
f230c61
updated rst files
crotwell Jul 14, 2021
50d3288
compare script from Chad to check that doc additions do not change th…
crotwell Jul 15, 2021
d52d35c
extra info printed
crotwell Jul 15, 2021
99c0479
even nicer prints
crotwell Jul 15, 2021
5c39935
add text about only using value for attributes
crotwell Jul 15, 2021
90be087
Merge pull request #72 from FDSN/lax_example
crotwell Jul 22, 2021
fc912c1
update example names and agency, use Jane Doe, example.com and USGS
crotwell Jul 22, 2021
a5e9a43
Polynomial set required to false
crotwell Jul 26, 2021
c4a6f86
add unit recommendation from iris validator
crotwell Jul 26, 2021
01d307d
add time appendix, specify ISO 8601 with Z, all examples have Z
crotwell Jul 26, 2021
62d62e7
doc endDate missing to mean active, no endDate in future
crotwell Jul 26, 2021
4e91e17
lake at 1200 m elevation example
crotwell Jul 26, 2021
719c8f7
remove leveldefault
crotwell Jul 26, 2021
6c1697f
revert m to METERS in draft to avoid any changes to stationxml schema…
crotwell Jul 26, 2021
0520a69
Merge branch 'draft' into doc_issues
crotwell Jul 26, 2021
433e795
no fixed values in examples
crotwell Jul 26, 2021
975f0f5
example units to SI.
crotwell Jul 26, 2021
ebbc2e3
make examples full valid stationxml, station ABCD, network XX, change…
crotwell Jul 28, 2021
0ed7803
network example to XX, station to ABCD
crotwell Jul 28, 2021
a47a4de
rename z.py to convert_xml_to_rst.py, add validation to script, renam…
crotwell Jul 28, 2021
b3e7d59
intro text for YSI to be included separately from xml
crotwell Jul 28, 2021
e02fec4
add validation to script, clean up
crotwell Jul 28, 2021
522ae21
extract Serta xml to separate file for validation purposes
crotwell Jul 28, 2021
b07d63c
pressure channel code to BDO
crotwell Jul 28, 2021
a24df46
fix intro include, check file exists for image include
crotwell Jul 28, 2021
e343a4d
create intro for Setra 270, add missing text from SEED manual, add ge…
crotwell Jul 28, 2021
f63b5b8
rename YSI-44031
crotwell Jul 28, 2021
0c7121e
network to XX and station to ABCD
crotwell Jul 28, 2021
eecba7d
regenerate rst for response examples
crotwell Jul 28, 2021
08884a8
move text above table to avoid dangling sentence
crotwell Jul 28, 2021
6f00ccd
add text about InstrumentSensitivity, note about overall gain
crotwell Jul 28, 2021
74dc627
recommend FDSN: style for sourceID
crotwell Jul 28, 2021
12867f4
add sub element table, link to element, with cardinality
crotwell Jul 28, 2021
d4ba7d1
copy symmetry docs from SEED manual
crotwell Jul 28, 2021
5490068
operator of station only used if different from network
crotwell Jul 28, 2021
e311d33
redo doc for InputUnits and OutputUnits to give real world example
crotwell Jul 28, 2021
fa899e0
new section in changes to group all warnings
crotwell Jul 28, 2021
ab8e5e8
add link to SI brochure, fix typo and E.g., change abbreviation to sy…
crotwell Aug 12, 2021
443c2b9
prefer symbols over names,
crotwell Aug 12, 2021
fed404c
add newline for range, update type to content type for clarity
crotwell Aug 27, 2021
14512e8
rst updates for changes to converter
crotwell Aug 27, 2021
b188a0b
add info on installing sphinx and needed packages
crotwell Aug 27, 2021
5041d4a
NormalizationFactor should be NormalizationFrequency
crotwell Nov 29, 2021
63cdf43
r < 1 not 0
crotwell Nov 29, 2021
15cc672
add install for lxml, show compare.sh output when no changes
crotwell Nov 29, 2021
c91e373
change code examples to use triple-quotes and without leading > for e…
crotwell Nov 29, 2021
1f346ea
also need elementpath
crotwell Dec 9, 2021
6cbafd7
script to check for non-ascii chars
crotwell Jan 7, 2022
c7ec9b9
not reference equipment in non-equipment resourceId
crotwell Jul 26, 2021
01fa59b
little s Polynomial stage
crotwell Jan 10, 2022
4e6b7ae
add utf-8 info
crotwell Jan 10, 2022
271f1aa
Updating equipment documentation.
jschaeff Jan 11, 2022
71a67c4
Getting rid of the repetition
jschaeff Jan 12, 2022
22b339b
Better FIR filter odd/even explanation
jschaeff Jan 12, 2022
2beb9e2
Split long lines
jschaeff Jan 12, 2022
b2dca33
Merge pull request #79 from crotwell/lake_waterlevel
crotwell Jan 19, 2022
a66711d
Merge pull request #88 from crotwell/show_subelements
crotwell Jan 19, 2022
122d730
Merge pull request #80 from crotwell/historical_code
crotwell Jan 19, 2022
810efb9
Merge pull request #107 from crotwell/resid_instpoly_redo
crotwell Jan 19, 2022
fd45da1
Merge pull request #83 from crotwell/no_unit_if_fixed
crotwell Jan 19, 2022
5009d5f
Merge pull request #84 from crotwell/SI_units_examples
crotwell Jan 19, 2022
f98cb97
Merge branch 'doc_issues' into valid_resp_examples
crotwell Jan 19, 2022
8d6cb0d
Merge pull request #86 from crotwell/valid_resp_examples
crotwell Jan 19, 2022
da58465
Merge branch 'doc_issues' into polynomail_not_req
crotwell Jan 19, 2022
9b8952a
Merge pull request #75 from crotwell/polynomail_not_req
crotwell Jan 19, 2022
2b03a34
Merge branch 'doc_issues' into iso_times
crotwell Jan 19, 2022
3f5de2d
Merge pull request #77 from crotwell/iso_times
crotwell Jan 19, 2022
0e1ce34
Merge branch 'doc_issues' into enddate_for_active
crotwell Jan 19, 2022
21921a0
Merge pull request #78 from crotwell/enddate_for_active
crotwell Jan 19, 2022
b66154e
Merge pull request #92 from crotwell/warning_section
crotwell Jan 19, 2022
a9edefc
Merge branch 'doc_issues' into sourceID
crotwell Jan 19, 2022
8ec80b6
Merge pull request #87 from crotwell/sourceID
crotwell Jan 19, 2022
f2a9adb
Merge pull request #91 from crotwell/responselist_units
crotwell Jan 19, 2022
c89bfd6
Merge pull request #89 from crotwell/fir_symmetry
crotwell Jan 19, 2022
a13c547
Merge pull request #76 from crotwell/unit_naming_rules
crotwell Jan 19, 2022
a8487d3
Merge pull request #108 from crotwell/char_encoding
crotwell Jan 19, 2022
2d63162
Merge pull request #97 from crotwell/type_range_lines
crotwell Jan 19, 2022
6a2bac6
Merge pull request #102 from crotwell/normalizationfrequency
crotwell Jan 19, 2022
a7098f2
Merge pull request #103 from crotwell/ztransform_r
crotwell Jan 19, 2022
4f5e017
rerun python convert, new line and S->s in Stage
crotwell Jan 19, 2022
36378c7
bad non-ascii quote, make script exec
crotwell Jan 19, 2022
47dc8df
update dates to 2022
crotwell Jan 19, 2022
9a8c33f
add newline
crotwell Jan 19, 2022
ccd6834
Merge pull request #109 from jschaeff/fix-101
crotwell Jan 19, 2022
a48de2e
Merge pull request #94 from crotwell/si_prefer_symbol
crotwell Jan 19, 2022
2b51fe3
Merge pull request #90 from crotwell/operator_net_sta
crotwell Jan 19, 2022
3990ffb
Merge pull request #74 from crotwell/person_example
crotwell Jan 19, 2022
531e6e2
Update README.md
Jan 19, 2022
04a6cc7
Merge pull request #27 from chad-iris/10_11_xslt
crotwell Jan 19, 2022
93ed50d
add text from README about 1.0 to 1.1 XSLT so will be in docs as well.
crotwell Jan 19, 2022
7180f87
updates for equipment and agency, regenerated from schema caused chan…
crotwell Jan 19, 2022
cc4c83f
update version to 1.1.1-alpha so is not 1.1 on web, not a final decis…
crotwell Jan 21, 2022
a7db706
prefer count
crotwell Jan 21, 2022
1a75eab
Merge pull request #115 from crotwell/prefer_count
crotwell Jan 21, 2022
8843360
prefer empty response for non-response channels
crotwell Jan 21, 2022
7314a44
preserve newlines in annotations, allows rst formatting within schema…
crotwell Jan 21, 2022
24b2ceb
add perfer docs on stage gain frequency
crotwell Jan 21, 2022
651a300
regen rst for new convert that preserves line endings
crotwell Jan 21, 2022
6022859
Merge branch 'doc_issues' into stage_freq_preference
crotwell Jan 21, 2022
6cde1a0
document prefer gain-only stage
crotwell Jan 24, 2022
5ca2b53
prefer not to use desc for units
crotwell Jan 24, 2022
038f7e0
add doi example for XX network
crotwell Jan 24, 2022
291db60
deprecate channel type
crotwell Jan 25, 2022
34e07e0
some warnings were being ignored
crotwell Jan 25, 2022
3497260
at least one numerator, warn future version will require
crotwell Jan 25, 2022
b92a2bd
override rtd css rule
crotwell Jan 25, 2022
c9d3ba6
don't automatically add periods to end of lines as this breaks up box…
crotwell Jan 25, 2022
9609d0d
remove many rogue periods
crotwell Jan 25, 2022
a56e254
Using Philip's dummy exemples
jschaeff Jan 26, 2022
6f9ec58
Merge pull request #110 from jschaeff/fix-70
crotwell Jan 26, 2022
200d0ba
use code block
crotwell Jan 27, 2022
46dffd2
fixes for issue #128 typos
crotwell Jan 27, 2022
fc58009
Merge branch 'doc_issues' into missing_response
crotwell Feb 17, 2022
cd02590
Merge pull request #117 from crotwell/missing_response
crotwell Feb 17, 2022
9cd7d25
Merge pull request #125 from crotwell/deprecate_channel_type
crotwell Feb 17, 2022
79cf93c
Merge pull request #121 from crotwell/unit_description
crotwell Feb 17, 2022
a68b30b
fix double negatuve, reorder and split over all gain to own line
crotwell Feb 17, 2022
032f08e
Merge pull request #118 from crotwell/stage_freq_preference
crotwell Feb 17, 2022
bcef30b
Merge pull request #120 from crotwell/gain_only_stage
crotwell Feb 17, 2022
f1c3236
Merge pull request #122 from crotwell/example_doi
crotwell Feb 17, 2022
53881e6
doc source or sender, not both
crotwell Feb 17, 2022
ae7b49b
two sample per day example
crotwell Feb 17, 2022
3d45ba0
Merge pull request #135 from crotwell/source-sender-doc
crotwell Feb 17, 2022
b17e91c
Merge pull request #136 from crotwell/sample-rate-ratio
crotwell Feb 17, 2022
59f0ae5
add example validate scripts
crotwell Feb 17, 2022
6f9018f
ignore _build dir
crotwell Feb 17, 2022
d731a9f
regenerate rst for PR schema file changes
crotwell Feb 17, 2022
9c16211
add different example doi for station and channel so not using networ…
crotwell Feb 18, 2022
3912c5e
info on 1.1.1 changes, list recommendations
crotwell Feb 18, 2022
0d2cf67
add link to W3C/ISO8601 docs
crotwell Feb 18, 2022
c3b4bdd
fix warning from sphinx
crotwell Feb 18, 2022
02cd96a
add attribute warnings to big list
crotwell Feb 18, 2022
39ab775
warnings for endData for active stations, timezone of Z for all times
crotwell Feb 18, 2022
0c59800
create spelling words from schema
crotwell Feb 21, 2022
cdeb05c
better mk dirs and sort output
crotwell Feb 21, 2022
0bdaa6f
typo
crotwell Feb 21, 2022
0fb0f98
spelling fixes
crotwell Feb 21, 2022
36628d7
g0 to g_0
crotwell Feb 21, 2022
2075cff
spelling
crotwell Feb 21, 2022
6ef0214
author spelling
crotwell Feb 21, 2022
3ad8aea
more spelling fixes and exceptions
crotwell Feb 21, 2022
9be1b44
need blank line and indent for math mode
crotwell Feb 21, 2022
d0d6fcd
remove bad 'eqn X'
crotwell Feb 21, 2022
35ad04c
spelling exceptions
crotwell Feb 21, 2022
579881b
spelling words extracted from schema
crotwell Feb 21, 2022
e753721
add info on spell checking rst files
crotwell Feb 21, 2022
cac0474
add warning comment to autogenerated files
crotwell Feb 21, 2022
bf1865c
literalinclude xml for examples
crotwell Feb 21, 2022
1731772
fix obspy example, literalinclude output
crotwell Feb 21, 2022
e41d07f
include schema location in examples, make overview example into liter…
crotwell Feb 21, 2022
6e872b1
update requirements, not sure how useful this is, but better up to date?
crotwell Feb 21, 2022
3880e26
ignore __pycache__
crotwell Feb 21, 2022
f0efaa6
updates per Petr from #141
crotwell Feb 22, 2022
b04167b
two more words
crotwell Feb 22, 2022
a138c1d
add convert target to regenerate rst files
crotwell Feb 22, 2022
4d78ec9
zap iris ns
crotwell Feb 24, 2022
f0735ad
Merge pull request #144 from crotwell/example_schema_loc
crotwell Feb 25, 2022
d1c29b4
Merge pull request #139 from crotwell/use_1.1.1
crotwell Feb 25, 2022
39a4cbe
Merge pull request #140 from crotwell/spelling
crotwell Feb 25, 2022
552ff74
Merge pull request #142 from crotwell/fix_import_example
crotwell Feb 25, 2022
8b34d3f
couple spelling errors
crotwell Feb 25, 2022
bcf72d9
version change to 1.2
crotwell Feb 25, 2022
5420d79
don't generate all_words.txt as it is not used
crotwell Feb 25, 2022
1943de1
more version to 1.2
crotwell Feb 25, 2022
9b93b89
version and date to 1.2
crotwell Feb 25, 2022
b3f4c06
example_1.rst not actually used
crotwell Feb 25, 2022
005c3fa
changes to obspy example per @megies
crotwell Feb 25, 2022
b2b39d6
example_1 file removed
crotwell Feb 25, 2022
2067d0b
add date
crotwell Feb 25, 2022
8d22781
zap another iris ns
crotwell Feb 25, 2022
646c52f
add 1.2 version of xslt transform
crotwell Feb 25, 2022
3b12046
need longer underline
crotwell Feb 25, 2022
f3b1657
date update
crotwell Feb 25, 2022
31395a1
add warn for schemaVersion to no longer be decimal
crotwell Feb 25, 2022
beaf741
remove non-symmetric sentence as it wrong, symmetry=None can be used …
crotwell Feb 25, 2022
fa32c7c
change deprecate to remove, as clearer items will not exist as oppose…
crotwell Feb 25, 2022
1e71fff
update branch in link to xslt file to master. Note this will be broke…
crotwell Feb 25, 2022
d68481c
regenerate rst form schema file, prepare for final review before vote…
crotwell Feb 25, 2022
c6ade62
Merge pull request #126 from crotwell/at_least_one_numerator
crotwell Feb 25, 2022
516f1ee
Merge branch 'doc_issues' into cleanup_for_1_2
crotwell Feb 25, 2022
1d2d437
clean up warn message
crotwell Feb 25, 2022
7fda10e
enable spelling by default
crotwell Feb 25, 2022
ac53ef2
run iris validator on examples if jar present
crotwell Feb 25, 2022
aa3caf0
redo convert for prev commits
crotwell Feb 25, 2022
05194ff
Merge pull request #148 from crotwell/cleanup_for_1_2
crotwell Feb 25, 2022
72ac40d
add 1.2 info
crotwell Feb 25, 2022
6639a7e
undo spelling in case that is causeing readthedocs to fail
crotwell Feb 26, 2022
e3a4bce
move spelling words to separate file, might cause problem with readth…
crotwell Feb 26, 2022
9a5e01d
Revert "update requirements, not sure how useful this is, but better …
crotwell Feb 26, 2022
8293355
update requirements to latest versions
crotwell Feb 28, 2022
e9019cc
downgrade docutils for sphinx depend conflict
crotwell Feb 28, 2022
6bee540
linuxdoc from pypi instead of github, likely more stable for long term
crotwell Feb 28, 2022
1e0c082
Merge pull request #151 from FDSN/doc_issues
crotwell May 2, 2022
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
6 changes: 5 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changes for FDSN StationXML format

## Changes from version 1.1 to 1.2 (2022-02-25)

Version 1.2 introduces no schema "as a schema" changes, other than the
schemaVersion attribute. All changes are additions of annotations and other documentation.

## Changes from version 1.0 to 1.1 (2019-5-3)

(Edited 2019-12-18 for small clarifications)
Expand Down Expand Up @@ -31,4 +36,3 @@
* Add `<WaterLevel>` within `<Station>` and `<Channel>`

* Add "subject" attribute to `<Comment>` to allow relating comments, make "id" attribute optional.

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ described above, must be followed for any changes to the schema.

Changes and issues should only be grouped together when logically
related in order to streamline review and acceptance.

## Translating StationXML 1.0 to 1.1 and later releases

The vast majority of the StationXML 1.0 schema exists in the 1.1 schema, making most 1.0 documents compatible
with the 1.1 schema. There are a few small exceptions where 1.0 elements were removed from 1.1, in one
important case to avoid the specification of incorrect metadata.

An [XSLT definition for StationXML 1.0 to 1.1 conversion](StationXML-1.0to1.1.xslt) exists to assist
with the systematic conversion of version 1.0 documents to the version 1.1 schema. This is done by removing the
elements no longer allowed in 1.1. A similar [XSLT for version 1.0/1.1 to 1.2](StationXML-1.0to1.2.xslt) also exists.
39 changes: 39 additions & 0 deletions StationXML-1.0to1.1.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fsx="http://www.fdsn.org/xml/station/1">

<!--
This XSLT 1.0 transform may be used to translate a StationXML version 1.0 document to version 1.1
Version: 2020-04-07

The document *must* declare the FDSN StationXML elements in a namespace of "http://www.fdsn.org/xml/station/1"

The following changes are applied by the transformation:
1) Change FDSNStationXML@schemaVersion from 1.0 to 1.1
2) Remove any .../Channel/StorageFormat elements, which are not allowed in 1.1
3) Remove any .../Channel/Response/Stage/StageGain elements when
.../Channel/Response/Stage/Polynomial elements are present,
which are not allowed in 1.1 as they are nearly always incompatible.
Note: This tranformation assumes the StageGain elements are in the document by
error (to stricly conform to 1.0) and the Polynomial is the intended filter.
-->

<!-- Identity template: copy all input to output and apply the included templates -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>

<!-- Change schemaVersion from 1.0 to 1.1 -->
<xsl:template match="/fsx:FDSNStationXML/@schemaVersion[. = '1.0']">
<xsl:attribute name="schemaVersion">1.1</xsl:attribute>
</xsl:template>

<!-- Remove StorageFormat -->
<xsl:template match="/fsx:FDSNStationXML/fsx:Network/fsx:Station/fsx:Channel/fsx:StorageFormat"/>

<!-- Remove StageGain element from Stage that contains Polynomial -->
<xsl:template match="/fsx:FDSNStationXML/fsx:Network/fsx:Station/fsx:Channel/fsx:Response/fsx:Stage[fsx:Polynomial]/fsx:StageGain"/>

</xsl:transform>
46 changes: 46 additions & 0 deletions StationXML-1.0to1.2.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fsx="http://www.fdsn.org/xml/station/1">

<!--
This XSLT 1.0 transform may be used to translate a StationXML
version 1.0 or 1.1 document to version 1.2
Version: 2022-02-25

The document *must* declare the FDSN StationXML elements in a namespace of
"http://www.fdsn.org/xml/station/1"

The following changes are applied by the transformation:
1) Change FDSNStationXML@schemaVersion from 1.0 to 1.2
2) Remove any .../Channel/StorageFormat elements, which are not allowed in 1.1
3) Remove any .../Channel/Response/Stage/StageGain elements when
.../Channel/Response/Stage/Polynomial elements are present,
which are not allowed in 1.1 as they are nearly always incompatible.
Note: This tranformation assumes the StageGain elements are in the document by
error (to stricly conform to 1.0) and the Polynomial is the intended filter.
-->

<!-- Identity template: copy all input to output and apply the included templates -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>

<!-- Change schemaVersion from 1.0 to 1.2 -->
<xsl:template match="/fsx:FDSNStationXML/@schemaVersion[. = '1.0']">
<xsl:attribute name="schemaVersion">1.2</xsl:attribute>
</xsl:template>

<!-- Also change schemaVersion from 1.1 to 1.2 -->
<xsl:template match="/fsx:FDSNStationXML/@schemaVersion[. = '1.1']">
<xsl:attribute name="schemaVersion">1.2</xsl:attribute>
</xsl:template>

<!-- Remove StorageFormat -->
<xsl:template match="/fsx:FDSNStationXML/fsx:Network/fsx:Station/fsx:Channel/fsx:StorageFormat"/>

<!-- Remove StageGain element from Stage that contains Polynomial -->
<xsl:template match="/fsx:FDSNStationXML/fsx:Network/fsx:Station/fsx:Channel/fsx:Response/fsx:Stage[fsx:Polynomial]/fsx:StageGain"/>

</xsl:transform>
3 changes: 3 additions & 0 deletions auditDocUpdate/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fdsn-station-1.1.xsd
fdsn-station*.nodocs
fdsn-station*.nodocs.tidy
38 changes: 38 additions & 0 deletions auditDocUpdate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### Audit Documentation Changes

Scripts to ensure addition of documentation does not make changes to the
structure of the FDSN StationXML schema. Running compare.sh should produce no
differences if the changes are confined to the documentation.

transform.py uses nodocs.xslt to remove all annotations, then tidy
cleans the output to remove non-structural changes like indentation.
Finally diff shows the raw textual differences between the two versions.

## Install

lxml is used by transform.py, install with:

```
conda install lxml
```

# Run

```
./compare.sh
```

If there are no schema changes besides annotations, the output should look like:

```
% ./compare.sh
Using: fdsn-station-1.1.xsd
Writing transformed XML to fdsn-station-1.1.xsd.nodocs
Writing transformed XML to fdsn-station-local.xsd.nodocs
diff from fdsn-station-local.xsd to fdsn-station-1.1.xsd
< is local tidy version, fdsn-station-local.xsd
> is fdsn tidy version, fdsn-station-1.1.xsd
Note line numbers are in nodocs.tidy,
which will be different from original xsd files.

```
20 changes: 20 additions & 0 deletions auditDocUpdate/check_ascii.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3

import sys
import re

opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
args = [arg for arg in sys.argv[1:] if not arg.startswith("-")]

if len(args) == 0:
print (f'Usage: {sys.argv[0]} inputXML ')
exit(0)

# Load source document
with open(args[0],'r') as doc:
for line_no, line in enumerate(doc):
non_ascii = re.sub('[\x00-\x7f]', '', line)
if len(non_ascii) > 0:
print(f"Found non-ascii chars of {non_ascii} on line {line_no}")


31 changes: 31 additions & 0 deletions auditDocUpdate/compare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# exit on error
set -e

XSD=fdsn-station-1.1.xsd
echo Using: $XSD

if [[ ! -f "$XSD" ]]; then
wget http://www.fdsn.org/xml/station/${XSD}
fi

/bin/rm -f ${XSD}.nodocs.tidy ${XSD}.nodocs
python3 ./transform.py $XSD nodocs.xslt ${XSD}.nodocs
tidy -xml -iq -o ${XSD}.nodocs.tidy ${XSD}.nodocs
/bin/rm -f ${XSD}.nodocs

LOCALXSD=fdsn-station-local.xsd
/bin/rm -f ${LOCALXSD}.nodocs ${LOCALXSD}.nodocs.tidy
python3 ./transform.py ../fdsn-station.xsd nodocs.xslt ${LOCALXSD}.nodocs
tidy -xml -iq -o ${LOCALXSD}.nodocs.tidy ${LOCALXSD}.nodocs
/bin/rm -f ${LOCALXSD}.nodocs

echo diff from ${LOCALXSD} to ${XSD}
echo '<' is local tidy version, ${LOCALXSD}
echo '>' is fdsn tidy version, ${XSD}
echo Note line numbers are in nodocs.tidy,
echo which will be different from original xsd files.
echo

diff -b ${LOCALXSD}.nodocs.tidy ${XSD}.nodocs.tidy
26 changes: 26 additions & 0 deletions auditDocUpdate/nodocs.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!--
This XSLT 1.0 transform may be used to remove annotation/documentation elements from XML

Annotation/Documentation elements stripped are identified as:
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xs:annotation
-->

<!-- Identity template: copy all input to output and apply the included templates -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>

<!-- Remove annotations -->
<xsl:template match="xs:annotation"/>

<!-- Remove comments (like this one) -->
<xsl:template match="comment()"/>

</xsl:transform>
34 changes: 34 additions & 0 deletions auditDocUpdate/transform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3

from lxml import etree
import sys

opts = [opt for opt in sys.argv[1:] if opt.startswith("-")]
args = [arg for arg in sys.argv[1:] if not arg.startswith("-")]

if len(args) == 0:
print (f'Usage: {sys.argv[0]} inputXML [XSLTfile [outputXML]]')
exit(0)

# Load source document
doc = etree.parse(args[0])

# Perform XSLT tranform
if len(args) > 1:
xslt = etree.parse(args[1])
transform = etree.XSLT(xslt)
newdoc = transform(doc)

# force end tags to make for easier diff

for elem in newdoc.iter(tag=etree.Element):
if elem.text is not None:
elem.text = elem.text.strip()
if elem.text is None or len(elem.text) == 0:
elem.text = '\n'

# Write to output file
if len(args) > 2:
print (f'Writing transformed XML to {args[2]}')
newdoc.write(args[2], pretty_print=False, strip_text=True)
#newdoc.write_output(args[2]) #, pretty_print=False)
2 changes: 2 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_build
__pycache__/
29 changes: 29 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

SCHEMA_FILE = $(SOURCEDIR)/../fdsn-station.xsd

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# convert generates: level-network.rst level-station.rst level-channel.rst
# level-response.rst warnings.rst
convert:
python convert_xsd_to_rst.py "$(SCHEMA_FILE)" "$(SOURCEDIR)"


# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Binary file added docs/Qx80_FIR_64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading