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
1fb0cf94
Commit
1fb0cf94
authored
Mar 29, 2019
by
Irving David
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Genera el findproducts.json con los nuevos parametros platform, productLevel y projectDir
parent
a6142606
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
views.py
catalog/views.py
+13
-11
No files found.
catalog/views.py
View file @
1fb0cf94
...
...
@@ -525,8 +525,8 @@ def Pay(request):
user
=
User
.
objects
.
get
(
id
=
request
.
user
.
id
)
product_list
=
[]
product_list
=
Purchase
.
objects
.
values
(
'id'
,
'search__area'
,
'user'
,
'user__username'
,
'user__email'
,
'search_id'
,
'search__clouds'
,
'search__startDate'
,
'search__endDate'
,
'search__search_name'
,
'search__description'
)
.
filter
(
user
=
user
,
purchased
=
0
)
'search__clouds'
,
'search__startDate'
,
'search__endDate'
,
'search__process_id__name'
,
'search__process_id__productLevel'
,
'search__process_id__platform__name'
)
.
filter
(
user
=
user
,
purchased
=
0
)
for
product
in
product_list
:
...
...
@@ -537,7 +537,10 @@ def Pay(request):
# print(str(product['search__endDate'].date()).replace("-", ""))
# print(product['search__clouds'])
# print(product['search__area'])
print
(
product
[
'id'
])
#print(product['search__process_id__name']) # Classification scene L1C o Classification scene L2A
#print(product['search__process_id__productLevel']) #L1C o L2A
#print(product['search__process_id__platform__name']) #Sentinel1 o Sentinel2
#print(product['id'])
username
=
product
[
'user__username'
]
useremail
=
product
[
'user__email'
]
...
...
@@ -551,19 +554,19 @@ def Pay(request):
if
not
os
.
path
.
exists
(
purchase_dir
):
os
.
makedirs
(
purchase_dir
)
products_dir
=
NAS_PATH
+
"sentinelImages/
L2A/
"
linksDir
=
purchase_dir
+
"/L2A
/"
products_dir
=
NAS_PATH
+
"sentinelImages/"
projectDir
=
purchase_dir
+
"
/"
# obtiene los datos para el json
data
=
{}
data
[
'wkt'
]
=
product
[
'search__area'
]
data
[
'platform'
]
=
'Sentinel-2'
data
[
'productLevel'
]
=
'L2A'
data
[
'platform'
]
=
product
[
'search__process_id__platform__name'
]
#
'Sentinel-2'
data
[
'productLevel'
]
=
product
[
'search__process_id__productLevel'
]
#
'L2A'
data
[
'startDate'
]
=
str
(
product
[
'search__startDate'
]
.
date
())
.
replace
(
"-"
,
""
)
# quita los guiones de la fecha
data
[
'endDate'
]
=
str
(
product
[
'search__endDate'
]
.
date
())
.
replace
(
"-"
,
""
)
# quita los guiones de la fecha
data
[
'clouds'
]
=
product
[
'search__clouds'
]
data
[
'productsDir'
]
=
products_dir
data
[
'
linksDir'
]
=
links
Dir
data
[
'
projectDir'
]
=
project
Dir
data
[
'username'
]
=
API_SENTINEL_USER
data
[
'password'
]
=
API_SENTINEL_PASS
...
...
@@ -576,8 +579,7 @@ def Pay(request):
fidProductsFile
.
write
(
json_data
)
fidProductsFile
.
close
()
os
.
system
(
SENTINEL_PATH
+
"/tools/L2ASCL_AreaProcessing.sh "
+
purchase_dir
+
"/ 1 > "
+
purchase_dir
+
"/L2ASCL_AreaProcessing.log"
)
###ejecuta el proceso
os
.
system
(
SENTINEL_PATH
+
"/tools/L2ASCL_AreaProcessing.sh "
+
purchase_dir
+
"/ 1 > "
+
purchase_dir
+
"/L2ASCL_AreaProcessing.log"
)
###ejecuta el proceso
...
...
@@ -600,7 +602,7 @@ def Pay(request):
# -------------------------------------
Purchase
.
objects
.
filter
(
user_id
=
request
.
user
.
id
,
purchased
=
0
,
pk
=
product
[
'id'
])
.
update
(
purchased
=
True
,
description
=
product
[
'search__description'
],
name
=
product
[
'search__search_name'
]
)
Purchase
.
objects
.
filter
(
user_id
=
request
.
user
.
id
,
purchased
=
0
)
.
update
(
purchased
=
True
)
return
redirect
(
'../../reports'
)
...
...
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