pesekon2 / GRASS-GIS-SOS-tools

My Google Summer of Code 2017 project. This is just development part. Intended GRASS GIS modules and final code will be at https://svn.osgeo.org/grass/grass-addons/
GNU General Public License v2.0
3 stars 1 forks source link

problem with istsos demo server #10

Closed lucadelu closed 7 years ago

lucadelu commented 7 years ago

Running this command

python v.in.sos.py url=http://istsos.org/istsos/demo? offering=LOCARNO observed_properties='urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature' response_format='text/xml;subtype="om/1.0.0"' output=locarno_temp event_time="2014-06-03T15:00:00+01:00/2014-06-03T18:00:00+01:00"

I got

Traceback (most recent call last):
  File "v.in.sos.py", line 266, in <module>
    main()
  File "v.in.sos.py", line 156, in main
    parsed_obs.update({property: xml2geojson(obs, property)})
  File "/home/lucadelu/github/GRASS-GIS-SOS-tools/format_conversions/xml2geojson.py", line 42, in xml2geojson
    for values in item.text.split(blockSeparator):
AttributeError: 'NoneType' object has no attribute 'split'
pesekon2 commented 7 years ago

It's strange. I have tried to save the xml from parsed_obs and I got output.txt and there are no observed values.

The problem is in time. When I try it without defining time or with v.in.sos url=http://istsos.org/istsos/demo? offering=LOCARNO observed_properties='urn:ogc:def:parameter:x-istsos:1.0:meteo:air:temperature' response_format='text/xml;subtype="om/1.0.0"' output=locarno_temp event_time="2014-06-03T13:00:00+01:00/2014-06-03T18:00:00+01:00" --overwrite it works (there are observed values).

lucadelu commented 7 years ago

Ok, if there are no observed values it cannot return that error but something like "There is no data, could you change the time parameter, observed properties, procedures or offerings"

lucadelu commented 7 years ago

Now it return

PROCESS INTERRUPTED
There is no data, could you change the time parameter, observed properties, procedures or offerings
WARNING: Coor file of vector map <locarno_temp@sos> is larger than it
         should be (18 bytes excess)
Building topology for vector map <locarno_temp@sos>...
Registering primitives...
0 primitives registered
0 vertices registered
Building areas...
 100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
Number of nodes: 0
Number of primitives: 0
Number of points: 0
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0

you should use grass.warning/grass.errors (probably better the second one, so the process will be stopped)

pesekon2 commented 7 years ago

Yes, it's caused by removing new (output vector). I have replaced it now with error in this commit but I'm not sure how clear it is to raise an error without closing and removing the output.

lucadelu commented 7 years ago

Commented your commit