5 Day forecast and the 'Value of the Rep Object'

42 views
Skip to first unread message

Russ Hore

unread,
Jan 10, 2016, 2:22:00 PM1/10/16
to Met Office DataPoint
I am using the 5 day forecast data and it is mostly working apart from getting the time offset for the readings.

The API Docs say "The value of the Rep object($ in the JSON representation) denotes the number of minutes after midnight UTC on the day represented by the Period object in which the Rep object is found."

How do you get the value of the Rep object?

I am using PHP and the rest of the code look something like this;

$obj->SiteRep->DV->Location->Period[$the_day]->Rep[0]->V)

Obviously;

$obj->SiteRep->DV->Location->Period[$the_day]->Rep[0]->$)

does not work. What am I missing?

liz.walker

unread,
Jan 11, 2016, 9:30:44 AM1/11/16
to metoffice...@googlegroups.com
Hi,

I've already had to tackle this.

Each element of the Rep array is actually a member of the standard class in PHP, which I isolated as the variable $repStd
I then accessed the $ value as follows:

            $classProperties = get_object_vars( $repStd );
            foreach( $classProperties  as $key => $value )
            {
                    switch ( $key )
                    {
                     case '$':

Russ Hore

unread,
Jan 11, 2016, 3:30:59 PM1/11/16
to liz.walker, Met Office DataPoint
Many thanks Liz, worked a treat.

Russ

On 11 Jan 2016, at 14:30, liz.walker <liz.w...@nottingham.ac.uk> wrote:

Hi,

I've already had to tackle this.

Each element of the Rep array is actually a member of the standard class in PHP, which I isolated as the variable $repStd
I then accessed the $ value as follows:

$classProperties = get_object_vars( $repStd );
            foreach( $classProperties  as $key => $value )
            {
switch ( $key )
                    {





On Sunday, 10 January 2016 19:22:00 UTC, Russ Hore wrote:
I am using the 5 day forecast data and it is mostly working apart from getting the time offset for the readings.

The API Docs say "The value of the Rep object($ in the JSON representation) denotes the number of minutes after midnight UTC on the day represented by the Period object in which the Rep object is found."

How do you get the value of the Rep object?

I am using PHP and the rest of the code look something like this;

$obj->SiteRep->DV->Location->Period[$the_day]->Rep[0]->V)

Obviously;

$obj->SiteRep->DV->Location->Period[$the_day]->Rep[0]->$)

does not work. What am I missing?

--
You received this message because you are subscribed to a topic in the Google Groups "Met Office DataPoint" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/metoffice-datapoint/4yGaU9puOvI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to metoffice-datap...@googlegroups.com.
To post to this group, send email to metoffice...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages