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
c5a3ec78
Commit
c5a3ec78
authored
May 29, 2018
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid repeated values
parent
f03ce510
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
+18
-13
views.py
catalog/views.py
+18
-13
No files found.
catalog/views.py
View file @
c5a3ec78
...
...
@@ -64,30 +64,35 @@ def productList(request):
## ----- aqui llamada a api sentinel
## ----- antes consultar en DB si no se tiene ya el producto
products
=
sentinel
.
getProducts
(
area
,
(
""
.
join
(
init_date
.
split
(
'-'
)),
""
.
join
(
end_date
.
split
(
'-'
))),
{
"platformname"
:
"Sentinel-2"
,
"cloudcoverpercentage"
:
cloud_percentage
})
date
=
(
""
.
join
(
init_date
.
split
(
'-'
)),
""
.
join
(
end_date
.
split
(
'-'
)))
params
=
{
"platformname"
:
"Sentinel-2"
}
# if cloud_percentage.strip():
# params['cloudcoverpercentage'] = cloud_percentage
params
[
'cloudcoverpercentage'
]
=
cloud_percentage
products
=
sentinel
.
getProducts
(
area
,
date
,
params
)
## simulation of 6-digit random id, this will be obtain from sentinel(?)
# random_id = ''.join(["%s" % random.randint(0, 9) for i in range(0, 6)])
## path from image preview storage location
img_preview
=
'/static/images/sat_preview/sat_test.jpg'
item_data
=
{
'process'
:
process
,
'start_date'
:
init_date
,
'end_date'
:
end_date
,
'cloud_percentage'
:
cloud_percentage
}
# se crea una lista de objetos del catalogo
catalog
=
[]
for
p
in
products
:
img_link
=
products
[
p
][
'link_icon'
]
img_link
=
img_link
[:
img_link
.
find
(
"/"
)
+
2
]
+
"emmhp:geoemm29@"
+
img_link
[
img_link
.
find
(
"/"
)
+
2
:]
item_data
[
'id'
]
=
products
[
p
][
'uuid'
]
item_data
[
'img'
]
=
img_link
item_data
[
'product'
]
=
products
[
p
]
catalog
.
append
(
item_data
)
catalog
.
append
({
'process'
:
process
,
'start_date'
:
init_date
,
'end_date'
:
end_date
,
'cloud_percentage'
:
cloud_percentage
,
'product'
:
products
[
p
],
'id'
:
products
[
p
][
'uuid'
],
'img'
:
img_link
})
return
JsonResponse
({
'catalog'
:
catalog
});
...
...
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