api-definitions icon indicating copy to clipboard operation
api-definitions copied to clipboard

Times returned do not make sense

Open glitchcrab opened this issue 6 years ago • 3 comments

I'll preface this by saying that this is possibly a daft question and may be due to my mis-understanding the docs.

The docs state that the /intensity endpoint (for example) returns 'data for current half hour', however this doesn't seem to add up as far as I can see.

)$ curl -s -X GET https://api.carbonintensity.org.uk/intensity | jq .data[]
{
  "from": "2019-09-12T08:00Z",
  "to": "2019-09-12T08:30Z",
  "intensity": {
    "forecast": 194,
    "actual": 188,
    "index": "moderate"
  }
}

However that isn't the current half hour:

$ nc time.nist.gov 13

58738 19-09-12 08:57:37 50 0 0 370.7 UTC(NIST) *

Am I not understanding the docs somehow?

glitchcrab avatar Sep 12 '19 08:09 glitchcrab

@alasdairrwbruce @Floppy apologies for the ping, not sure how well monitored this repo is though.

(also, hello from a fellow Horshamite!)

glitchcrab avatar Sep 17 '19 20:09 glitchcrab

Hey there @glitchcrab - I'm not involved any more, but given your example and my own test just now, yeah, I confirm that /intensity gives the latest complete half hour not the current.

Looking back at my emails, @alasdairrwbruce described that endpoint as returning the "latest settlement period", which I think means the latest complete half hour in the jargon. So, I suspect that's intended behaviour, but with an inaccurate description in the docs.

Looking back into the history, as I suspected, that's my fault - I think I wrote that doc line in https://github.com/carbon-intensity/api-definitions/commit/88cfc1eda66c9294c8dd825c11ea73207ebbc2ba#diff-514408aa2dfdbfae10f5f21c61fb73d0R29, and it's just wrong :)

Good catch, and thanks for letting us know. @alasdairrwbruce I'm not sure how you're generating those doc pages these days, would a PR to fix them here be best or is there a master copy somewhere that needs modifying?

Floppy avatar Sep 17 '19 21:09 Floppy

Thanks @Floppy, appreciate the input! That makes much more sense to me now :+1:

glitchcrab avatar Sep 19 '19 08:09 glitchcrab