More detailed attribution
This commit is contained in:
parent
7ec968d3bb
commit
35b90992aa
@ -1,4 +1,5 @@
|
|||||||
# Adapted from https://simplemaps.com/data/world-cities
|
# Adapted from https://simplemaps.com/data/world-cities
|
||||||
|
# Licensed under Creative Commons Attribution 4.0 (https://creativecommons.org/licenses/by/4.0/
|
||||||
Tokyo;35.6897
|
Tokyo;35.6897
|
||||||
Jakarta;-6.1750
|
Jakarta;-6.1750
|
||||||
Delhi;28.6100
|
Delhi;28.6100
|
||||||
|
Can't render this file because it is too large.
|
@ -71,7 +71,7 @@ public class CreateMeasurements3 {
|
|||||||
// which we'll use as a "source of city name randomness"
|
// which we'll use as a "source of city name randomness"
|
||||||
var bigName = new StringBuilder(1 << 20);
|
var bigName = new StringBuilder(1 << 20);
|
||||||
try (var rows = new BufferedReader(new FileReader("data/weather_stations.csv"));) {
|
try (var rows = new BufferedReader(new FileReader("data/weather_stations.csv"));) {
|
||||||
rows.readLine(); // Skip the attribution line
|
skipComments(rows);
|
||||||
while (true) {
|
while (true) {
|
||||||
var row = rows.readLine();
|
var row = rows.readLine();
|
||||||
if (row == null) {
|
if (row == null) {
|
||||||
@ -85,7 +85,7 @@ public class CreateMeasurements3 {
|
|||||||
var minLen = Integer.MAX_VALUE;
|
var minLen = Integer.MAX_VALUE;
|
||||||
var maxLen = Integer.MIN_VALUE;
|
var maxLen = Integer.MIN_VALUE;
|
||||||
try (var rows = new BufferedReader(new FileReader("data/weather_stations.csv"))) {
|
try (var rows = new BufferedReader(new FileReader("data/weather_stations.csv"))) {
|
||||||
rows.readLine(); // Skip the attribution line
|
skipComments(rows);
|
||||||
final var nameSource = new StringReader(bigName.toString());
|
final var nameSource = new StringReader(bigName.toString());
|
||||||
final var buf = new char[MAX_NAME_LEN];
|
final var buf = new char[MAX_NAME_LEN];
|
||||||
final var rnd = ThreadLocalRandom.current();
|
final var rnd = ThreadLocalRandom.current();
|
||||||
@ -146,6 +146,11 @@ public class CreateMeasurements3 {
|
|||||||
return weatherStations;
|
return weatherStations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void skipComments(BufferedReader rows) throws IOException {
|
||||||
|
while (rows.readLine().startsWith("#")) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static char readNonSpace(StringReader nameSource) throws IOException {
|
private static char readNonSpace(StringReader nameSource) throws IOException {
|
||||||
while (true) {
|
while (true) {
|
||||||
var n = nameSource.read();
|
var n = nameSource.read();
|
||||||
|
Loading…
Reference in New Issue
Block a user