Skip to content

Commit

Permalink
Merging latest master into livestats work
Browse files Browse the repository at this point in the history
  • Loading branch information
mirzov committed Nov 26, 2019
2 parents b24701b + 0a835a7 commit 992cc51
Show file tree
Hide file tree
Showing 62 changed files with 1,404 additions and 898 deletions.
44 changes: 44 additions & 0 deletions src/main/bash/dlStats.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

# ICOS Sweden filter:
# --data-urlencode 'filter={"dobj.submission.submitter.self.uri": "http://meta.icos-cp.eu/resources/organizations/icosSweden"}' \

# Data L2 filter:
# --data-urlencode 'filter={"dobj.specification.dataLevel": 2}' \

# Lund University downloads filter:
# --data-urlencode 'filter={"ip": {"$regex": "^130\\.235.*"}}' \

function getDlStats {
STATION_ID=$1
YEAR=$2

echo -n $STATION_ID $YEAR' '

curl -s -G \
--data-urlencode 'filter={"dobj.specificInfo.acquisition.station.id": "'$STATION_ID'"}' \
--data-urlencode 'filter={"ip": {"$regex": "^130\\.235.*"}}' \
--data-urlencode 'filter={"time": {"$regex": "^'$YEAR'.*"}}' \
'https://restheart.icos-cp.eu/db/dobjdls?np&count&hal=f&pagesize=1' \
| jq -r '._size'
}

# for STATION_ID in HTM NOR SVB 'SE-Deg' 'SE-Htm' 'SE-Lnn' 'SE-Nor' 'SE-Sto' 'SE-Svb' 'SE-Oes'; do
# for YEAR in 2017 2018 2019; do
# sleep 0
# getDlStats $STATION_ID $YEAR
# done
# done

function saveGeoStats {
FILENAME=$1

curl -s -G \
--data-urlencode 'keys={"country_code": 1, "_id": 0}' \
--data-urlencode 'filter={"dobj.specificInfo.acquisition.station.id": {"$in": ["HTM", "NOR", "SVB", "SE-Deg", "SE_Htm", "SE-Lnn", "SE-Nor", "SE-Sto", "SE-Oes"]}}' \
'https://restheart.icos-cp.eu/db/dobjdls?np&pagesize=1000000' > $FILENAME

cat $FILENAME | jq -r '.[] | [.country_code] | @tsv' | sort | uniq -c
}

saveGeoStats geoStats.json
1 change: 1 addition & 0 deletions src/main/js/common/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
1 change: 0 additions & 1 deletion src/main/js/common/main/backend.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import config from "./config";
import 'whatwg-fetch';


export const saveToRestheart = dataToSave => {
Expand Down
46 changes: 30 additions & 16 deletions src/main/js/common/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/main/js/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "cpdata-frontend",
"version": "0.1.0",
"engines": {
"npm": ">=6.12.0"
},
"private": true,
"description": "Carbon Portal Data Service",
"repository": {
Expand Down Expand Up @@ -43,7 +46,6 @@
"watchify": "^3.11.1"
},
"dependencies": {
"icos-cp-spatial": "^0.2.0",
"whatwg-fetch": "^2.0.4"
"icos-cp-spatial": "^0.2.0"
}
}
1 change: 1 addition & 0 deletions src/main/js/dashboard/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict=true
Loading

0 comments on commit 992cc51

Please sign in to comment.