Commit d1b0106099544e53b444ba8928b4a9d21f8100b7
Exists in
master
and in
9 other branches
Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/DDServer
Showing
4 changed files
with
12 additions
and
12 deletions
Show diff stats
src/DDSERVICES/HAPI/capabilities.php
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | |
8 | 8 | header('Content-Type: application/json'); |
9 | 9 | header("Access-Control-Allow-Origin: *"); |
10 | - header("Access-Control-Allow-Methods: GET"); //'Access-Control-Allow-{Origin,Methods} = {*, GET}'); | |
10 | + header("Access-Control-Allow-Methods: GET"); | |
11 | 11 | |
12 | 12 | exit(json_encode($response)); |
13 | 13 | ?> | ... | ... |
src/DDSERVICES/HAPI/catalog.php
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | |
16 | 16 | header('Content-Type: application/json'); |
17 | 17 | header("Access-Control-Allow-Origin: *"); |
18 | - header("Access-Control-Allow-Methods: GET"); //'Access-Control-Allow-{Origin,Methods} = {*, GET}'); | |
18 | + header("Access-Control-Allow-Methods: GET"); | |
19 | 19 | |
20 | 20 | exit(json_encode($response)); |
21 | 21 | ?> | ... | ... |
src/DDSERVICES/HAPI/data.php
... | ... | @@ -37,8 +37,9 @@ |
37 | 37 | $response["HAPI"] = "2.0"; |
38 | 38 | |
39 | 39 | if (!$_GET["id"]) { |
40 | - $response["status"] = 400; | |
41 | - $response["msg"] = "No ID !!!"; | |
40 | + header("HTTP/1.1 404 NO SUCH ID"); | |
41 | + $response["status"] = 1406; | |
42 | + $response["msg"] = "NO SUCH ID !!!"; | |
42 | 43 | |
43 | 44 | header('Content-Type: application/json'); |
44 | 45 | |
... | ... | @@ -68,6 +69,8 @@ |
68 | 69 | } |
69 | 70 | |
70 | 71 | disable_ob(); |
72 | + header("Access-Control-Allow-Origin: *"); | |
73 | + header("Access-Control-Allow-Methods: GET"); | |
71 | 74 | $handle = popen($cmd, 'r'); |
72 | 75 | while(!feof($handle)) { |
73 | 76 | $buffer = fgets($handle); | ... | ... |
src/DDSERVICES/HAPI/reader.py
... | ... | @@ -16,6 +16,7 @@ import shutil |
16 | 16 | import gzip |
17 | 17 | import tempfile |
18 | 18 | import time |
19 | +import calendar | |
19 | 20 | import datetime |
20 | 21 | import dateutil.parser |
21 | 22 | import xml.etree.ElementTree as ET |
... | ... | @@ -255,9 +256,8 @@ def get_start_stop_from_times_nc_file(metadata, localpath, tmin, tmax): |
255 | 256 | localpath = metadata['LOCATION'] |
256 | 257 | |
257 | 258 | times_nc_file = "{}{}".format(localpath, metadata['TIMES']) |
258 | - | |
259 | - start = time.mktime(tmin.timetuple()) | |
260 | - stop = time.mktime(tmax.timetuple()) | |
259 | + start = calendar.timegm(tmin.timetuple()) | |
260 | + stop = calendar.timegm(tmax.timetuple()) | |
261 | 261 | |
262 | 262 | command = _GETFILENAMES+' '+str(times_nc_file)+' '+str(start)+' '+str(stop) |
263 | 263 | result = subprocess.check_output(command, shell=True) |
... | ... | @@ -339,9 +339,8 @@ def main(argv): |
339 | 339 | para_index = None |
340 | 340 | para_name = par |
341 | 341 | var_index[para_name].append(para_index) |
342 | - | |
342 | + | |
343 | 343 | #variables = OrderedDict([(key, variables[key]) for key in para]) |
344 | - | |
345 | 344 | if tmin <= cur_end_time and tmax >= cur_start_time: # checking if file contains data within interval |
346 | 345 | # time = [amda_to_datetime(cur_time) for cur_time in nc.variables['Time']] |
347 | 346 | time = map(amda_to_datetime, nc.variables['Time']) |
... | ... | @@ -351,9 +350,7 @@ def main(argv): |
351 | 350 | break |
352 | 351 | |
353 | 352 | if cur_dt >= tmin and cur_dt <= tmax: |
354 | - | |
355 | - stream = '{}'.format(cur_dt.isoformat()) | |
356 | - | |
353 | + stream = '{}'.format(cur_dt.isoformat()) | |
357 | 354 | for var in variables: |
358 | 355 | if not 'Time' in var: |
359 | 356 | cur_data = nc.variables[var][cur_index] | ... | ... |