Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
b2f58cb9
Commit
b2f58cb9
authored
Mar 29, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pdf v2
parent
f8931e6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
views.py
reports/views.py
+28
-11
No files found.
reports/views.py
View file @
b2f58cb9
...
@@ -46,8 +46,8 @@ def report_L2ASCL(request, purchase_id):
...
@@ -46,8 +46,8 @@ def report_L2ASCL(request, purchase_id):
template
=
"sclData.html"
template
=
"sclData.html"
reporteDir
=
'mask'
reporteDir
=
'mask'
folders
=
""
folders
=
""
purchase
=
Purchase
.
objects
.
values
(
'user__email'
,
'is_public'
,
'search__search_name'
,
purchase
=
Purchase
.
objects
.
values
(
'user__email'
,
'is_public'
,
'search__search_name'
,
'search__process_id__name'
)
.
get
(
pk
=
purchase_id
)
'search__process_id__name'
)
.
get
(
pk
=
purchase_id
)
email
=
purchase
[
'user__email'
]
email
=
purchase
[
'user__email'
]
path
=
USERS_PATH
+
email
+
'/'
+
purchase_id
+
'/'
path
=
USERS_PATH
+
email
+
'/'
+
purchase_id
+
'/'
scl_data_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/scl_data.json"
scl_data_path
=
USERS_PATH
+
email
+
"/"
+
purchase_id
+
"/scl_data.json"
...
@@ -74,7 +74,7 @@ def report_L2ASCL(request, purchase_id):
...
@@ -74,7 +74,7 @@ def report_L2ASCL(request, purchase_id):
"process"
:
purchase
[
'search__process_id__name'
],
"process"
:
purchase
[
'search__process_id__name'
],
"startDate"
:
startDate
,
"startDate"
:
startDate
,
"endDate"
:
endDate
,
"endDate"
:
endDate
,
"clouds"
:
dataProduct
[
'clouds'
],
"clouds"
:
dataProduct
[
'clouds'
],
"platform"
:
dataProduct
[
'platform'
],
"platform"
:
dataProduct
[
'platform'
],
"productLevel"
:
dataProduct
[
'productLevel'
],
"productLevel"
:
dataProduct
[
'productLevel'
],
"polygon"
:
dataProduct
[
'wkt'
],
"polygon"
:
dataProduct
[
'wkt'
],
...
@@ -333,16 +333,27 @@ def dataToTable(name, data):
...
@@ -333,16 +333,27 @@ def dataToTable(name, data):
# create the table for our document
# create the table for our document
def
myTable
(
path1
,
path2
,
basefile
):
def
myTable
(
path1
,
path2
,
basefile
):
image1
=
Image
(
path1
,
height
=
300
,
width
=
200
,
mask
=
'auto'
)
#image1 = Image(path1, height=300, width=200, mask='auto')
image1
=
Image
(
path1
)
if
image1
.
imageWidth
<
image1
.
imageHeight
:
print
(
"mas alto que ancho"
)
image2
=
Image
(
path1
,
height
=
300
,
width
=
200
,
mask
=
'auto'
)
else
:
image2
=
Image
(
path1
,
height
=
150
,
width
=
400
,
mask
=
'auto'
)
path
,
dirs
,
files
=
next
(
os
.
walk
(
path2
))
path
,
dirs
,
files
=
next
(
os
.
walk
(
path2
))
for
file
in
files
:
for
file
in
files
:
if
file
.
startswith
(
basefile
[:
8
]):
if
file
.
startswith
(
basefile
[:
8
]):
if
file
.
endswith
(
'.tif'
)
and
not
file
.
endswith
(
'0.tif'
):
if
file
.
endswith
(
'.tif'
)
and
not
file
.
endswith
(
'0.tif'
):
# image2 = Image(path2 + file, height=300, width=200, mask='auto')
# image2 = Image(path2 + file, height=300, width=200, mask='auto')
image
2
=
image1
image
3
=
image2
data
=
[[
'TCI'
,
'SCL'
],
[
image1
,
image2
]]
if
image1
.
imageWidth
<
image1
.
imageHeight
:
data
=
[[
'TCI'
,
'SCL'
],
[
image2
,
image3
]]
else
:
data
=
[[
'TCI'
],
[
image2
],
[
'SCL'
],
[
image3
]]
t
=
Table
(
data
)
t
=
Table
(
data
)
GRID_STYLE
=
TableStyle
(
GRID_STYLE
=
TableStyle
(
...
@@ -372,7 +383,7 @@ def myBarChart(data, maxi, fecha):
...
@@ -372,7 +383,7 @@ def myBarChart(data, maxi, fecha):
bc
.
strokeColor
=
colors
.
black
bc
.
strokeColor
=
colors
.
black
bc
.
valueAxis
.
valueMin
=
0
bc
.
valueAxis
.
valueMin
=
0
bc
.
valueAxis
.
valueMax
=
maxi
+
100
bc
.
valueAxis
.
valueMax
=
maxi
+
100
bc
.
valueAxis
.
valueStep
=
50
bc
.
valueAxis
.
valueStep
=
50
bc
.
categoryAxis
.
labels
.
boxAnchor
=
'ne'
bc
.
categoryAxis
.
labels
.
boxAnchor
=
'ne'
...
@@ -456,19 +467,25 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
...
@@ -456,19 +467,25 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
values
=
[]
values
=
[]
labels
=
[]
labels
=
[]
maxi
=
0
maxi
=
0
#for data in datasets:
#
for data in datasets:
for
data
in
datasets
[:
len
(
datasets
)
-
1
]:
for
data
in
datasets
[:
len
(
datasets
)
-
1
]:
if
maxi
>
data
[
'data'
][
index
]:
if
maxi
>
data
[
'data'
][
index
]:
maxi
=
maxi
maxi
=
maxi
else
:
else
:
maxi
=
data
[
'data'
][
index
]
maxi
=
data
[
'data'
][
index
]
#print (maxi)
#
print (maxi)
values
.
append
([
data
[
'data'
][
index
]])
values
.
append
([
data
[
'data'
][
index
]])
labels
.
append
(
data
[
'label'
])
labels
.
append
(
data
[
'label'
])
path1
=
thumbs
+
file
path1
=
thumbs
+
file
# Header
# Header
# print (width)
#########################33
im
=
Image
(
USERS_PATH
+
'header.png'
,
width
=
300
,
height
=
70
)
im
=
Image
(
USERS_PATH
+
'header.png'
,
width
=
300
,
height
=
70
)
im
.
hAlign
=
'CENTER'
im
.
hAlign
=
'CENTER'
story
.
append
(
im
)
story
.
append
(
im
)
...
@@ -491,9 +508,9 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
...
@@ -491,9 +508,9 @@ def PDFGenerator(request, ruta, reporteDir, datasets):
story
.
append
(
Spacer
(
1
,
.5
*
inch
))
story
.
append
(
Spacer
(
1
,
.5
*
inch
))
# add barchart and legend
# add barchart and legend
#drawing = myBarChart(values[:len(values) - 1], maxi, file)
#
drawing = myBarChart(values[:len(values) - 1], maxi, file)
drawing
=
myBarChart
(
values
,
maxi
,
file
)
drawing
=
myBarChart
(
values
,
maxi
,
file
)
#drawing = myBarLegend(drawing, labels[:len(labels) - 1])
#
drawing = myBarLegend(drawing, labels[:len(labels) - 1])
drawing
=
myBarLegend
(
drawing
,
labels
)
drawing
=
myBarLegend
(
drawing
,
labels
)
drawing
.
hAlign
=
'CENTER'
drawing
.
hAlign
=
'CENTER'
story
.
append
(
drawing
)
story
.
append
(
drawing
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment