Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,6 @@
These regions are removed from countries-to-generate.json, because they are too large even for extra_small profile:
```
257829111 Aug 3 15:55 'Russia_Sakha Republic.isolines'
164222539 Aug 3 15:45 'Russia_Krasnoyarsk Krai_North.isolines'
```
Other USA and Russia regions are promoted: poor -> extra_small. "poor" profile is completely useless, IMO.

View file

@ -0,0 +1,31 @@
import json
from os import listdir
data = object()
with open('countries-to-generate.json') as f1:
countries = set()
data = json.load(f1)
tree = data['countryParams']
for e in tree:
countries.add(e['key'])
for f2 in listdir('../../borders/'):
c = f2[:-5]
if c not in countries:
print(c)
entry = {
"key": c,
"value": {
"profileName": "poor",
"tileCoordsSubset": list(),
"tilesAreBanned": False
}
}
tree.append(entry)
with open('countries-to-generate.json', "w") as f3:
json.dump(data, f3, indent=4)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,88 @@
{
"profiles": [
{
"key": "high",
"value": {
"alitudesStep": 20,
"gaussianFilterRFactor": 1.0,
"gaussianFilterStDev": 2.0,
"latLonStepFactor": 1,
"maxIsolinesLength": 500,
"medianFilterR": 1,
"simplificationZoom": 17
}
},
{
"key": "high_f2",
"value": {
"alitudesStep": 20,
"gaussianFilterRFactor": 1.0,
"gaussianFilterStDev": 2.0,
"latLonStepFactor": 2,
"maxIsolinesLength": 500,
"medianFilterR": 1,
"simplificationZoom": 17
}
},
{
"key": "high_f3",
"value": {
"alitudesStep": 20,
"gaussianFilterRFactor": 1.0,
"gaussianFilterStDev": 2.0,
"latLonStepFactor": 3,
"maxIsolinesLength": 500,
"medianFilterR": 1,
"simplificationZoom": 15
}
},
{
"key": "normal",
"value": {
"alitudesStep": 50,
"gaussianFilterRFactor": 1.0,
"gaussianFilterStDev": 2.0,
"latLonStepFactor": 1,
"maxIsolinesLength": 500,
"medianFilterR": 1,
"simplificationZoom": 15
}
},
{
"key": "small",
"value": {
"alitudesStep": 50,
"gaussianFilterRFactor": 1.0,
"gaussianFilterStDev": 2.0,
"latLonStepFactor": 1,
"maxIsolinesLength": 500,
"medianFilterR": 1,
"simplificationZoom": 14
}
},
{
"key": "extra_small",
"value": {
"alitudesStep": 50,
"gaussianFilterRFactor": 1.0,
"gaussianFilterStDev": 2.0,
"latLonStepFactor": 4,
"maxIsolinesLength": 500,
"medianFilterR": 1,
"simplificationZoom": 14
}
},
{
"key": "poor",
"value": {
"alitudesStep": 100,
"gaussianFilterRFactor": 1.0,
"gaussianFilterStDev": 2.0,
"latLonStepFactor": 4,
"maxIsolinesLength": 500,
"medianFilterR": 1,
"simplificationZoom": 14
}
}
]
}

View file

@ -0,0 +1,132 @@
'''
An ad-hoc script to analyze impact of isolines profiles changes
and update regions' profiles according to certain criteria.
Input size files are produced by `ls -sk` of e.g. directory with isolines files.
They should look like (sizes are in KB):
total 11176840
3892 Abkhazia.isolines
39472 Afghanistan.isolines
10904 Albania.isolines
'''
import json
from os import listdir
data = object()
with open('countries-to-generate.json') as f_profiles:
data = json.load(f_profiles)
profiles = data["countryParams"]
mwms = {}
# Current MWM file sizes
with open('mwm-250622.txt') as f_mwms:
for line in f_mwms:
line = line.split(maxsplit=1)
if line[1][-4:] == "mwm\n":
mwm = line[1][:-5]
mwms[mwm] = {"size" : int(line[0]) * 1024}
for e in profiles:
if e["key"] in mwms:
mwms[e["key"]]["profile"] = e["value"]["profileName"]
else:
print(e["key"], " is missing in mwm sizes file!")
# Current isolines file sizes
with open('isolines-250622.txt') as f_mwms:
for line in f_mwms:
line = line.split(maxsplit=1)
if line[1][-9:] == "isolines\n":
mwm = line[1][:-10]
mwms[mwm]["iso_current"] = int(line[0]) * 1024
mwms[mwm]["base_size"] = mwms[mwm]["size"] - mwms[mwm]["iso_current"]
mwms[mwm]["iso_current%"] = round(mwms[mwm]["iso_current"] / mwms[mwm]["base_size"] * 100)
with open('isolines-100-f4-s14.txt') as f_mwms:
for line in f_mwms:
line = line.split(maxsplit=1)
if line[1][-9:] == "isolines\n":
mwm = line[1][:-10]
if (int(line[0]) > 4):
mwms[mwm]["iso_100-f4-s14"] = int(line[0]) * 1024
mwms[mwm]["iso_100-f4-s14%"] = round(mwms[mwm]["iso_100-f4-s14"] / mwms[mwm]["base_size"] * 100)
# New isolines file sizes for the 50-f4-s14 settings (f4 is latLonStepFactor, s14 is simplificationZoom).
# They were produced only for MWMs which have worse profiles now (e.g. poor and extra_small).
with open('isolines-50-f4-s14.txt') as f_mwms:
for line in f_mwms:
line = line.split(maxsplit=1)
if line[1][-9:] == "isolines\n":
mwm = line[1][:-10]
mwms[mwm]["iso_50-f4-s14"] = int(line[0]) * 1024
mwms[mwm]["iso_50-f4-s14%"] = round(mwms[mwm]["iso_50-f4-s14"] / mwms[mwm]["base_size"] * 100)
with open('isolines-50-f3-s14.txt') as f_mwms:
for line in f_mwms:
line = line.split(maxsplit=1)
if line[1][-9:] == "isolines\n":
mwm = line[1][:-10]
mwms[mwm]["iso_50-f3-s14"] = int(line[0]) * 1024
mwms[mwm]["iso_50-f3-s14%"] = round(mwms[mwm]["iso_50-f3-s14"] / mwms[mwm]["base_size"] * 100)
with open('isolines-20-f3-s15.txt') as f_mwms:
for line in f_mwms:
line = line.split(maxsplit=1)
if line[1][-9:] == "isolines\n":
mwm = line[1][:-10]
mwms[mwm]["iso_20-f3-s15"] = int(line[0]) * 1024
mwms[mwm]["iso_20-f3-s15%"] = round(mwms[mwm]["iso_20-f3-s15"] / mwms[mwm]["base_size"] * 100)
print("Action\tMWM\tCurProfile\tCur%ofBase\tNew%ofBase\tIsoSizeMB\tNewMwmSizeMB\tSizeChangeMB\tSizeChange%")
for mwm, sizes in mwms.items():
if "profile" in sizes:
if sizes["profile"] in ["poor", "extra_small", "small", "normal"]:
if "iso_20-f3-s15%" in sizes:
new_size_20 = round((sizes["base_size"] + sizes["iso_20-f3-s15"]) / 1024 / 1024)
new_size_50 = round((sizes["base_size"] + sizes["iso_50-f4-s14"]) / 1024 / 1024)
# Upgrade to 20m step if
# mwm size growth <= 15% or new size is small anyway < 20MB or isolines take < 25% of mwm size
if ((sizes["iso_20-f3-s15%"] < 30 or new_size_20 < 20 or (sizes["iso_20-f3-s15"]-sizes["iso_current"]) <= sizes["size"]*0.15) and new_size_20 < 500):
print("UP-20-f3-s15\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d" % (mwm, sizes["profile"], sizes["iso_current%"], sizes["iso_20-f3-s15%"], round(sizes["iso_20-f3-s15"]/1024/1024), new_size_20, round((sizes["iso_20-f3-s15"] - sizes["iso_current"])/1024/1024), round(100 * (sizes["iso_20-f3-s15"] - sizes["iso_current"]) / sizes["size"])))
sizes["new_profile"] = "high_f3"
# Upgrade to 50m step if
# mwm size growth <= 30% or new size is small anyway < 30MB or isolines take < 40% of mwm size
elif (sizes["profile"] in ["poor", "extra_small"] and (sizes["iso_50-f4-s14%"] < 40 or new_size_50 < 30 or (sizes["iso_50-f4-s14"]-sizes["iso_current"]) <= sizes["size"]*0.30) and new_size_50 < 500):
print("NO-20-CHANGE\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d" % (mwm, sizes["profile"], sizes["iso_current%"], sizes["iso_20-f3-s15%"], round(sizes["iso_20-f3-s15"]/1024/1024), new_size_20, round((sizes["iso_20-f3-s15"] - sizes["iso_current"])/1024/1024), round(100 * (sizes["iso_20-f3-s15"] - sizes["iso_current"]) / sizes["size"])))
print("UP-50-f4-s14\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d" % (mwm, sizes["profile"], sizes["iso_current%"], sizes["iso_50-f4-s14%"], round(sizes["iso_50-f4-s14"]/1024/1024), new_size_50, round((sizes["iso_50-f4-s14"] - sizes["iso_current"])/1024/1024), round(100 * (sizes["iso_50-f4-s14"] - sizes["iso_current"]) / sizes["size"])))
sizes["new_profile"] = "extra_small"
elif sizes["profile"] in ["poor", "extra_small"]:
new_size_100 = round((sizes["base_size"] + sizes["iso_100-f4-s14"]) / 1024 / 1024)
print("NO-50-CHANGE\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d" % (mwm, sizes["profile"], sizes["iso_current%"], sizes["iso_50-f4-s14%"], round(sizes["iso_50-f4-s14"]/1024/1024), new_size_50, round((sizes["iso_50-f4-s14"] - sizes["iso_current"])/1024/1024), round(100 * (sizes["iso_50-f4-s14"] - sizes["iso_current"]) / sizes["size"])))
# "Downgrade" from extra_small 100-f1-s14 to poor 100-f4-s14 (somewhat more smoothed lines and filtered small knobs; but reduce file size)
if sizes["profile"] == "extra_small":
print("DOWN-100-f4-s14\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d" % (mwm, sizes["profile"], sizes["iso_current%"], sizes["iso_100-f4-s14%"], round(sizes["iso_100-f4-s14"]/1024/1024), new_size_100, round((sizes["iso_100-f4-s14"] - sizes["iso_current"])/1024/1024), round(100 * (sizes["iso_100-f4-s14"] - sizes["iso_current"]) / sizes["size"])))
sizes["new_profile"] = "poor"
elif sizes["profile"] in ["small", "normal"]:
print("NO-20-CHANGE\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d" % (mwm, sizes["profile"], sizes["iso_current%"], sizes["iso_20-f3-s15%"], round(sizes["iso_20-f3-s15"]/1024/1024), new_size_20, round((sizes["iso_20-f3-s15"] - sizes["iso_current"])/1024/1024), round(100 * (sizes["iso_20-f3-s15"] - sizes["iso_current"]) / sizes["size"])))
else:
print(mwm, "is missing in isolines sizes file!")
for e in profiles:
if e["key"] in mwms:
if "new_profile" in mwms[e["key"]]:
e["value"]["profileName"] = mwms[e["key"]]["new_profile"]
else:
print(e["key"], " is missing in mwm sizes file!")
with open('countries-to-generate.json', "w") as f_out:
json.dump(data, f_out, indent=4)