[webservices] A question of location ID, how to represent empty IDs in XML?

Chad Trabant chad at iris.washington.edu
Thu Jul 24 11:34:07 PDT 2014


Hi Yazan,

(passing along our in-person conversation for the list)

I do not think allowing a null or optional location ID is a good idea, here is why: in SEED there is always a location ID (the two-byte field cannot be left out), it is always known; when it is empty it is still a specific location ID.  Allowing optional location ID in XML leaves a translation from StationXML to SEED a bit ambiguous.  The spec would have to clarify that "not present" always means the empty location ID in SEED, I find this translation not nearly as clear and obvious as having a real value present.

As you say, many parsers will have problems with ""  or "  ".  It should not be up to every reader (e.g. converters) of StationXML to properly interpret the multiple possible results coming out of any parser, the formats should have a unique and unambiguous mapping.

Chad

On Jul 24, 2014, at 9:29 AM, Yazan Suleiman <yazan.suleiman at gmail.com> wrote:

> Is modifying stationxml schema (to allow null location, required=false) a possibility?  example:
> <Channel startDate="1992-09-23T00:00:00" restrictedStatus="open" endDate="1994-04-01T00:00:00" code="BHE">
> vs
> <Channel locationCode=" " startDate="1992-09-23T00:00:00" restrictedStatus="open" endDate="1994-04-01T00:00:00" code="BHE">
> vs
> <Channel locationCode="--" startDate="1992-09-23T00:00:00" restrictedStatus="open" endDate="1994-04-01T00:00:00" code="BHE">
> 
> It is very reasonable to have a null value for location in any object representation of station schema. "  " or "" is inaccurate and only introduces more trouble and complexity.
> 
> 
> If changing the schema is not an option then "  " or "" is a very bad idea.  Many parsers treat "" or "  " as empty and will ignore them.  If translating this into SEED is the issue, then it is the convertor responsibility to take care of the conversion.  
> 
> Yazan
> 
> 
> On Wed, Jul 23, 2014 at 10:30 AM, Chad Trabant <chad at iris.washington.edu> wrote:
> 
> Hello WS users and developers,
> 
> A recent discussion between FDSN data centers is centered on representation of empty location IDs in StationXML, the default format returned by the fdsnws-station web service.  The DMC may be changing how it represents location ID in XML and text formats based on these discussions.  We are asking for input as any such change will effect users of our metadata service.
> 
> Some background: In the SEED channel naming scheme there is a hierarchy of network, station, location and channel identifiers.  Of these, it is only the location ID that is commonly accepted to be empty.  In the SEED format the location ID is a two-character field, where the value is left justified and padded with spaces if needed.  When the value is empty the field is simply two spaces of padding.
> 
> Historically, and presumably to avoid having an empty location ID, the DMC has represented “empty” location IDs as a string of two spaces.  Following this practice, we express this in StationXML by setting the locationCode attribute to a string of two spaces.  We have done this so long we sometimes forget that it is not compliant with a strict reading of SEED, at best it falls into the vagaries of SEED, on the other hand we have been doing it for years with no apparent problems (in fact it has helpfully avoided an empty core identifier).
> 
> There now exists another fdsnws-station implementation that returns StationXML with the locationCode attribute set to an empty string when the SEED value is empty.  The justification is that this follows the SEED rules of trimming the padding spaces from the values.
> 
> Unfortunately this means there are now flavors of StationXML that are incompatible in the core channel name identifiers.  In other words, two StationXML documents for the same SEED channel appear, without extra field translation, to be different channels.
> 
> As most of you are users of SEED and StationXML metadata (at some level) and some of you have written code to parse these formats and manage the data returned by the DMC and other FDSN data centers, we are asking for your input regarding the potential solutions.
> 
> Here are the options being considered for mapping an empty location ID in SEED to StationXML:
> 
> 1) Set locationCode to two spaces.  While the DMC and users have been using this for a long while, it is not precisely the SEED value (but the mapping could be formalized).  Also, whitespace in attributes does have some theoretical challenges: the wonky rules for XML attributes related to whitespace handling require removal of spaces in some cases (we have never heard of problems though).
> 
> 2) Set locationCode to an empty string.  This would match the strict value present in SEED, an empty identifier.
> 
> 3) Set locationCode to “--“ (two dashes).  This avoids issues with whitespace in XML attribute values and avoids issues with an empty identifier.  Also, this matches the request mechanisms where “--“ is accepted as a synonym for an empty location ID.
> 
> All of these solutions are viable in that we can make them work in code, it is a matter of choosing one for future FDSN metadata, pick your poison so to speak.
> 
> In my personal opinion, an empty location ID is an unfortunate quirk of SEED that we should rectify in StationXML.  An empty identifier can be confused for “unknown” if the programmer is not careful, which is semantically very different than “set to empty”.  The two-space strings that the DMC is currently using are also not ideal, they are hard for humans to read and potentially weird with XML rules.  The dashed location ID avoids these issues but requires the most change.  I also think requiring all readers of StationXML to translate (e.g. remove padding) is a bad idea, the values in SEED should be uniquely mapped to values in StationXML.
> 
> Thanks for reading this far.  Your opinion and input is appreciated.
> 
> regards,
> Chad
> 
> 
> _______________________________________________
> webservices mailing list
> webservices at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/webservices
> 
> _______________________________________________
> webservices mailing list
> webservices at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/webservices

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.iris.washington.edu/pipermail/webservices/attachments/20140724/1a5edbd3/attachment.html>


More information about the webservices mailing list