get_bbox unlinked from base
This commit is contained in:
parent
87174bfb83
commit
2a8d03bae5
@ -1,26 +0,0 @@
|
|||||||
module.exports = class {
|
|
||||||
|
|
||||||
set_scale(scale){
|
|
||||||
this.scale = scale
|
|
||||||
}
|
|
||||||
|
|
||||||
get_bbox(data){
|
|
||||||
return data.reduce(
|
|
||||||
(s, c) => ({
|
|
||||||
l: Math.min(s.l, c.x),
|
|
||||||
t: Math.min(s.t, c.y),
|
|
||||||
r: Math.max(s.r, c.x),
|
|
||||||
b: Math.max(s.b, c.y),
|
|
||||||
}),
|
|
||||||
{ l: data[0].x, t: data[0].y, r: data[0].x, b: data[0].y }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
wells_layer(wells){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
render(){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,116 +0,0 @@
|
|||||||
export default {
|
|
||||||
max_date(){
|
|
||||||
return `SELECT MAX(date(year||'-01-01', (month - 1)||' month')) as date FROM production_injections`
|
|
||||||
},
|
|
||||||
|
|
||||||
devobjs(){
|
|
||||||
return `SELECT distinct(object) as devobj FROM production_injections`
|
|
||||||
},
|
|
||||||
|
|
||||||
totals(devobj){
|
|
||||||
return `SELECT
|
|
||||||
wells.well, wells.whx, wells.why
|
|
||||||
,SUM(production_injections.woptm) as wopt
|
|
||||||
,SUM(production_injections.wwptm) as wwpt
|
|
||||||
,SUM(production_injections.wsgptv) as wgpt
|
|
||||||
,SUM(production_injections.wwitv) as wwit
|
|
||||||
,SUM(production_injections.days) as days
|
|
||||||
,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
|
|
||||||
,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
|
|
||||||
FROM
|
|
||||||
wells, production_injections
|
|
||||||
WHERE
|
|
||||||
wells.well=production_injections.well
|
|
||||||
AND production_injections.object='${devobj}'
|
|
||||||
GROUP BY
|
|
||||||
wells.well
|
|
||||||
ORDER BY
|
|
||||||
wlpt DESC, wwit DESC`
|
|
||||||
},
|
|
||||||
|
|
||||||
rates(devobj, date){
|
|
||||||
date = new Date(date)
|
|
||||||
const year_month = date.getFullYear()*100 + date.getMonth()
|
|
||||||
return `SELECT
|
|
||||||
wells.well, wells.whx, wells.why
|
|
||||||
,SUM(production_injections.woptm)/SUM(production_injections.days) as wopr
|
|
||||||
,SUM(production_injections.wwptm)/SUM(production_injections.days) as wwpr
|
|
||||||
,SUM(production_injections.wsgptv)/SUM(production_injections.days) as wgpr
|
|
||||||
,SUM(production_injections.wwitv)/SUM(production_injections.days) as wwir
|
|
||||||
,SUM(production_injections.days) as days
|
|
||||||
,(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) / SUM(production_injections.days) as wlpr
|
|
||||||
,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
|
|
||||||
FROM
|
|
||||||
wells, production_injections
|
|
||||||
WHERE
|
|
||||||
wells.well=production_injections.well
|
|
||||||
AND production_injections.object='${devobj}'
|
|
||||||
AND (year*100+month)=${year_month}
|
|
||||||
GROUP BY
|
|
||||||
wells.well`
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
production_injection(field, devobj, date){
|
|
||||||
const f_date = date ? `AND year*1000+month=${date.getFullYear()*1000+date.getMonth()}` : ''
|
|
||||||
console.log(f_date)
|
|
||||||
|
|
||||||
return `SELECT
|
|
||||||
wells.well, wells.whx, wells.why
|
|
||||||
,SUM(production_injections.woptm) as wopt
|
|
||||||
,SUM(production_injections.wwptm) as wwpt
|
|
||||||
,SUM(production_injections.wsgptv) as wgpt
|
|
||||||
,SUM(production_injections.wwitv) as wwit
|
|
||||||
,SUM(production_injections.days) as days
|
|
||||||
,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
|
|
||||||
,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
|
|
||||||
FROM
|
|
||||||
wells, production_injections
|
|
||||||
WHERE
|
|
||||||
AND wells.well=production_injections.well
|
|
||||||
AND production_injections.object='${devobj}'
|
|
||||||
AND (year*1000+month)=${max_year_month}
|
|
||||||
GROUP BY
|
|
||||||
wells.well`
|
|
||||||
},
|
|
||||||
|
|
||||||
production_total(field, devobj){
|
|
||||||
return `SELECT
|
|
||||||
wells.well, wells.whx, wells.why
|
|
||||||
,SUM(production_injections.woptm) as wopt
|
|
||||||
,SUM(production_injections.wwptm) as wwpt
|
|
||||||
,SUM(production_injections.wsgptv) as wgpt
|
|
||||||
,SUM(production_injections.wwitv) as wwit
|
|
||||||
,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
|
|
||||||
,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
|
|
||||||
FROM
|
|
||||||
wells, production_injections
|
|
||||||
WHERE
|
|
||||||
wells.well=production_injections.well
|
|
||||||
AND object='${devobj}'
|
|
||||||
GROUP BY
|
|
||||||
wells.well`
|
|
||||||
},
|
|
||||||
|
|
||||||
injection_total(){
|
|
||||||
const query_all = `SELECT
|
|
||||||
wells.well, wells.whx, wells.why
|
|
||||||
,SUM(production_injections.woptm) as wopt
|
|
||||||
,SUM(production_injections.wwptm) as wwpt
|
|
||||||
,SUM(production_injections.wsgptv) as wgpt
|
|
||||||
,SUM(production_injections.wwitv) as wwit
|
|
||||||
,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
|
|
||||||
,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
|
|
||||||
FROM
|
|
||||||
wells, production_injections
|
|
||||||
WHERE
|
|
||||||
wells.well=production_injections.well
|
|
||||||
AND object='${devobj}'
|
|
||||||
GROUP BY
|
|
||||||
wells.well
|
|
||||||
HAVING
|
|
||||||
wwit>0
|
|
||||||
|
|
||||||
`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
module.exports = class {
|
|
||||||
constructor(url){
|
|
||||||
this.url = url
|
|
||||||
}
|
|
||||||
|
|
||||||
get_wells(){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -3,12 +3,12 @@ const well_head = require('./drawers/well-head')
|
|||||||
const corel_layer = require('./drawers/corel-layer')
|
const corel_layer = require('./drawers/corel-layer')
|
||||||
const BBox = require('../libs/bbox')
|
const BBox = require('../libs/bbox')
|
||||||
|
|
||||||
function get_wells_bbox(data) {
|
function get_bbox(data, min_size = 1000) {
|
||||||
let bbox = BBox.from_array(data.map((w) => ({ x: w.whx, y: w.why })));
|
let bbox = BBox.from_array(data)
|
||||||
|
|
||||||
if (bbox.w() == 0 || bbox.h() == 0) {
|
if (bbox.w() == 0 || bbox.h() == 0) {
|
||||||
bbox.r += 1000;
|
bbox.r += min_size;
|
||||||
bbox.b += 1000;
|
bbox.b += min_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bbox;
|
return bbox;
|
||||||
@ -65,7 +65,7 @@ function build_it_layer(wells, settings, style) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
get_wells_bbox,
|
get_bbox,
|
||||||
build_pt_layer,
|
build_pt_layer,
|
||||||
build_it_layer,
|
build_it_layer,
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user