error with SOS4R

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

error with SOS4R

G.Laty
Hi all,

My name is Guillaume and I'm working for the unep GRID. I'm trying SOS4R to get some data from itsos.

Here is what I do and what's happening as an error

 
> mySOS <- SOS(url = "http://ig3is.grid.unep.ch/istsos/ghg")

  off.temp <- sosOfferings(mySOS)[[1]]



>> obs.temp.procedure.1 <- getObservation(sos = mySOS, offering = off.temp, procedure = sosProcedures(off.temp))
> [sos4R] Received response (size: 848 bytes), parsing ...
> Error in if (.subtypeIdx > 0) { : argument is of length zero


Here is the sessionInfo()

  > sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu 14.04.5 LTS

and I use this version of SOS4R
  sos4R_0.2-11

Does anyone have any idea how can I get unstucked?

Thanks,

Guillaume


_______________________________________________
Geostatistics mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geostatistics
http://geostatistics.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: error with SOS4R

Daniel Nüst
Hi Guillaume,

thanks for your interest in sos4R :-)

On 12/04/17 11:14, Guillaume Laty wrote:

> My name is Guillaume and I'm working for the unep GRID. I'm trying SOS4R
> to get some data from itsos.
>
> Here is what I do and what's happening as an error
>
>  
>> mySOS <- SOS(url = "http://ig3is.grid.unep.ch/istsos/ghg")
>
>  off.temp <- sosOfferings(mySOS)[[1]]
>
>>> obs.temp.procedure.1 <- getObservation(sos = mySOS, offering =
>>> off.temp, procedure = sosProcedures(off.temp))
>> [sos4R] Received response (size: 848 bytes), parsing ...
>> Error in if (.subtypeIdx > 0) { : argument is of length zero
>
>
> Here is the sessionInfo()
>
>  > sessionInfo()
> R version 3.3.3 (2017-03-06)
> Platform: i686-pc-linux-gnu (32-bit)
> Running under: Ubuntu 14.04.5 LTS
>
> and I use this version of SOS4R
>  sos4R_0.2-11
>
> Does anyone have any idea how can I get unstucked?
I can reproduce the error, which is good!

By using "GET" as the communication protocol instead of the default
"POST", I get a bit further.

> mySOS <- SOS(url = "http://ig3is.grid.unep.ch/istsos/ghg", method =
SosSupportedConnectionMethods()[["GET"]])

> getObservation(sos = mySOS, offering = off.temp)
[sos4R] Received response (size: 9256 bytes), parsing ...
Error in sum(.resultLength) : invalid 'type' (list) of argument
In addition: Warning messages:
1: In .valParser(values = obj[[sweValuesName]], fields = .fields,
encoding = .encoding,  :
  No converter found for the given field Time,
urn:ogc:def:parameter:x-istsos:1.0:time:iso8601
2: In .valParser(values = obj[[sweValuesName]], fields = .fields,
encoding = .encoding,  :
  No converter found! Skipping field Time
No converter found! Skipping field
urn:ogc:def:parameter:x-istsos:1.0:time:iso8601

In the vignette [1] section 6.4 you find instructions on how to define
the missing converters.

If you switch on the verbose option, you will also see the raw requests,
which might help:

> getObservation(sos = mySOS, offering = off.temp, verbose = TRUE)

This shows me that data is indeed returned.


Hope this helps for now, please keep us posted on your progress.

/Daniel

[1] https://cran.r-project.org/web/packages/sos4R/vignettes/sos4R.pdf


--
Daniel Nüst
Institute for Geoinformatics (ifgi),   University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 31962
http://ifgi.uni-muenster.de/~d_nues01        http://o2r.info


_______________________________________________
Geostatistics mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geostatistics
http://geostatistics.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: error with SOS4R

ninsbl
Hi,

My name is Stefan Blumentrath and at NINA we currently testing the sos4R
client against the istSOS SOS implementation, as R is quite popular in our
institute.

Unfortunately, we are facing similar issues as Guillaume, so that we are not
able to perform getObservation requests against istSOS with sos4R (see R
script [1] in the gist below).

With default POST method always get the following error message:

[sos4R] Received response (size: 1104 bytes), parsing ...
Error in if (.subtypeIdx > 0) { : argument is of length zero

And when switching to GET (as in the R script) we get:

Error in cat("Formatted ", obj, " to ", .formatted) :
  argument 2 (type 'list') cannot be handled by 'cat'

So not exactly the "converter problem" but also with istSOS implementation.

However, the corresponding request seem to work as expected on the server…

http://istsos.org/istsos/demo?service=SOS&request=GetObservation&offering=temporary&procedure=P_LUGANO&eventTime=2014-05-01T00:00:00+01/2014-12-4T17:00:00+01,2013-01-30T17:30:00+01&observedProperty=rainfall&responseFormat=text/xml;subtype=%27sensorML/1.0.0%27&service=SOS&version=1.0.0

We are grateful for any pointer on how to fix this and thanks for sos4R!

Kind regards,
Stefan

1: https://gist.github.com/ninsbl/25fb87cb88c33e61716d60ce15f4b82e



--
Sent from: http://geostatistics.forum.52north.org/
_______________________________________________
Geostatistics mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geostatistics
http://geostatistics.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: error with SOS4R

Daniel Nüst-2
Hi Stefan,

just for the sake of completeness: can you please post your sessionInfo()?

On 06/09/17 09:59, ninsbl wrote:

> My name is Stefan Blumentrath and at NINA we currently testing the sos4R
> client against the istSOS SOS implementation, as R is quite popular in our
> institute.
>
> Unfortunately, we are facing similar issues as Guillaume, so that we are not
> able to perform getObservation requests against istSOS with sos4R (see R
> script [1] in the gist below).
>
> With default POST method always get the following error message:
>
> [sos4R] Received response (size: 1104 bytes), parsing ...
> Error in if (.subtypeIdx > 0) { : argument is of length zero
>
> And when switching to GET (as in the R script) we get:
>
> Error in cat("Formatted ", obj, " to ", .formatted) :
>   argument 2 (type 'list') cannot be handled by 'cat'

I can confirm the error in the version on CRAN and the current
development version. So thanks for the bug report!

You can try out the fix in the current development branch, see
https://github.com/52North/sos4R/tree/dev#install-the-development-version


I also included the istSOS default time name to the list of converters,
so that should also work for you rightaway, because the other observed
properties are identified as numeric by their UOM.

Note that you have to instantiate the SOS differently:

mySOS <- SOS(url = "http://istsos.org/istsos/demo", binding = "KVP")

[...]

> observation <- getObservation(sos = mySOS
+                               , observedProperty =
sosObservedProperties(mySOS)[[4]]
+                               , offering = sosOfferings(mySOS)[[4]]
+                               , procedure = sosProcedures(mySOS)[[4]]
+                               #, srsName = '4326'
+                               , responseFormat = getObsFormat
+                               , eventTime = tPeriod
+                               #, verbose = TRUE
+ )
[sos4R] Received response (size: 158912 bytes), parsing ...
[sos4R] Finished getObservation to http://istsos.org/istsos/demo
        --> received 1 observation(s) having 4464 result values [ 4464 ].

> summary(sosResult(observation))
      Time                      air.rainfall
 Min.   :2014-05-03 14:30:00   Min.   :0.00000
 1st Qu.:2014-05-11 08:27:30   1st Qu.:0.00000
 Median :2014-05-19 02:25:00   Median :0.00000
 Mean   :2014-05-19 02:25:00   Mean   :0.01958
 3rd Qu.:2014-05-26 20:22:30   3rd Qu.:0.00000
 Max.   :2014-06-03 14:20:00   Max.   :6.20000





/Daniel


> So not exactly the "converter problem" but also with istSOS implementation.
>
> However, the corresponding request seem to work as expected on the server…
>
> http://istsos.org/istsos/demo?service=SOS&request=GetObservation&offering=temporary&procedure=P_LUGANO&eventTime=2014-05-01T00:00:00+01/2014-12-4T17:00:00+01,2013-01-30T17:30:00+01&observedProperty=rainfall&responseFormat=text/xml;subtype=%27sensorML/1.0.0%27&service=SOS&version=1.0.0
>
> We are grateful for any pointer on how to fix this and thanks for sos4R!
>
> Kind regards,
> Stefan
>
> 1: https://gist.github.com/ninsbl/25fb87cb88c33e61716d60ce15f4b82e
>
>
>
> --
> Sent from: http://geostatistics.forum.52north.org/
> _______________________________________________
> Geostatistics mailing list
> [hidden email]
> http://list.52north.org/mailman/listinfo/geostatistics
> http://geostatistics.forum.52north.org
> Please respect our mailing list guidelines:
> http://52north.org/resources/mailing-lists-and-forums/guidelines
>

--
Daniel Nüst
Institute for Geoinformatics (ifgi),   University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 31962
http://ifgi.uni-muenster.de/~d_nues01        http://o2r.info
_______________________________________________
Geostatistics mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geostatistics
http://geostatistics.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: error with SOS4R

ninsbl
In reply to this post by G.Laty

Hi Daniel,

 

Many thanks for the amazingly quick fix!

 

I can confirm that getObservaton now works with the development version!

 

This is great!

 

Cheers

Stefan

 


_______________________________________________
Geostatistics mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geostatistics
http://geostatistics.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines
Reply | Threaded
Open this post in threaded view
|

Re: error with SOS4R

ninsbl
In reply to this post by G.Laty

For completeness:

 

sessionInfo()

R version 3.4.0 (2017-04-21)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows >= 8 x64 (build 9200)

 

Matrix products: default

 

locale:

[1] LC_COLLATE=Norwegian Bokmål_Norway.1252  LC_CTYPE=Norwegian Bokmål_Norway.1252  

[3] LC_MONETARY=Norwegian Bokmål_Norway.1252 LC_NUMERIC=C                            

[5] LC_TIME=Norwegian Bokmål_Norway.1252   

 

attached base packages:

[1] stats     graphics  grDevices utils     datasets  methods   base    

 

other attached packages:

[1] lubridate_1.6.0 sos4R_0.3       sp_1.2-5        RCurl_1.95-4.8  bitops_1.0-6  

[6] XML_3.98-1.9  

 

loaded via a namespace (and not attached):

[1] Rcpp_0.12.12    lattice_0.20-35 rprojroot_1.2   digest_0.6.12   withr_2.0.0   

 [6] grid_3.4.0      backports_1.1.0 nlme_3.1-131    magrittr_1.5    evaluate_0.10.1

[11] stringi_1.1.5   rmarkdown_1.6   devtools_1.13.3 tools_3.4.0     stringr_1.2.0 

[16] yaml_2.1.14     compiler_3.4.0  htmltools_0.3.6 memoise_1.1.0   knitr_1.17

 

Using RStudio and:

 

sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS
 
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
 
locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
 
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
 
other attached packages:
[1] lubridate_1.6.0   sos4R_0.3         sp_1.2-5          XML_3.98-1.9     
[5] RCurl_1.95-4.8    bitops_1.0-6      RSQLite_2.0       RPostgreSQL_0.4-1
[9] DBI_0.6-13       
 
loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10.4  lattice_0.20-35 digest_0.6.12   grid_3.4.0      magrittr_1.5   
 [6] stringi_1.1.5   blob_1.1.0      tools_3.4.0     stringr_1.2.0   bit64_0.9-5    
[11] bit_1.1-12      compiler_3.4.0  memoise_1.1.0   tibble_1.3.0   

 

Using RStudio Server


_______________________________________________
Geostatistics mailing list
[hidden email]
http://list.52north.org/mailman/listinfo/geostatistics
http://geostatistics.forum.52north.org
Please respect our mailing list guidelines:
http://52north.org/resources/mailing-lists-and-forums/guidelines