updat

parent 5d4d5eef
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"platform": "Sentinel-2",
"productLevel":"L2A",
"startDate": "20150101",
"endDate": "20191018",
"clouds":"4",
"productsDir":"/home/geoint/NAS/sentinelImages/",
"projectDir": "/home/geoint/NAS/mario_MID/",
"username":"mario-chirinos",
"password":"r4nc0r4u"
}
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
#from myModule import myModule
import json
import os
import datetime
#===============================================================================
def createDirectories(jsonfile, cfgfile):
with open(cfgfile) as cfg_file:
cfg = json.load(cfg_file)
with open(jsonfile) as json_file:
data = json.load(json_file)
for p in data:
dirname = p["properties"]["Clv_Unica"]
# print(cfg)
for k in cfg.keys():
p[k]=cfg[k]
print(os.getcwd())
p["productsDir"]=os.getcwd()+"/"+dirname+"/"
p["endDate"]=datetime.datetime.now().strftime("%Y%m%d")
if not os.path.exists(dirname):
os.mkdir(dirname)
with open(dirname+'/findProducts.json', 'w') as outfile:
json.dump(p, outfile)
#===============================================================================
def main(argv):
if len(sys.argv) != 3:
print(len(sys.argv))
print ("Usage: "+argv[0] + " <json> <cfg>")
else:
createDirectories(argv[1], argv[2])
if __name__ == "__main__":
main(sys.argv)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
import json
#from myModule import myModule
#===============================================================================
def convertToWKT(filename, outfile):
newdata = []
with open(filename) as json_file:
data = json.load(json_file)
for d in data["features"]:
prop = d["properties"]
print("POLYGON: ", len(d))
i = 0
if len(d["geometry"]["coordinates"][0]) > 1:
print(i)
wkt = "POLYGON (( "
for p in d["geometry"]["coordinates"][0]:
wkt+=str(p[0])+" "+ str(p[1]) +", "
i+=1
wkt=wkt[:-2]+" ))"
print(wkt)
newdata.append({"WKT":wkt, "properties":prop})
with open(outfile, 'w') as outfile:
json.dump(newdata, outfile)
#===============================================================================
def main(argv):
if len(sys.argv) != 3:
print ("Usage text")
else:
convertToWKT(argv[1], argv[2])
if __name__ == "__main__":
main(sys.argv)
#!/bin/sh
for d in */ ; do
L2ASCL_AreaProcessing.sh $(pwd)/"$d" 0
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment