Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
geomultisens
gms-aux
Commits
59484e86
Commit
59484e86
authored
Aug 08, 2017
by
Daniel Eggert
Browse files
added csv2db class stump
parent
ee427b28
Changes
1
Hide whitespace changes
Inline
Side-by-side
gms-metadatacrawler/src/main/java/de/potsdam/gfz/gms/metadatacrawler/LandsatCollection1CsvUpdate.java
0 → 100644
View file @
59484e86
package
de.potsdam.gfz.gms.metadatacrawler
;
import
java.nio.file.Paths
;
import
java.sql.ResultSet
;
import
java.util.HashSet
;
import
java.util.Scanner
;
import
java.util.Set
;
import
de.potsdam.gfz.gms.database.SceneDatabase
;
public
class
LandsatCollection1CsvUpdate
{
// browseAvailable,browseURL,sceneID,LANDSAT_PRODUCT_ID,sensor,acquisitionDate,dateUpdated,path,row,upperLeftCornerLatitude,upperLeftCornerLongitude,upperRightCornerLatitude,upperRightCornerLongitude,lowerLeftCornerLatitude,lowerLeftCornerLongitude,lowerRightCornerLatitude,lowerRightCornerLongitude,sceneCenterLatitude,sceneCenterLongitude,cloudCover,cloudCoverFull,dayOrNight,sunElevation,sunAzimuth,receivingStation,sceneStartTime,sceneStopTime,imageQuality1,DATA_TYPE_L1,cartURL,ROLL_ANGLE,GEOMETRIC_RMSE_MODEL,GEOMETRIC_RMSE_MODEL_X,GEOMETRIC_RMSE_MODEL_Y,FULL_PARTIAL_SCENE,NADIR_OFFNADIR,PROCESSING_SOFTWARE_VERSION,CPF_NAME,RLUT_FILE_NAME,BPF_NAME_OLI,BPF_NAME_TIRS,GROUND_CONTROL_POINTS_MODEL,GROUND_CONTROL_POINTS_VERSION,DATE_L1_GENERATED,TIRS_SSM_MODEL,COLLECTION_NUMBER,COLLECTION_CATEGORY,CLOUD_COVER_LAND
public
static
void
main
(
String
[]
args
)
throws
Throwable
{
// get all entityids for L8C1 from database as well as from the csv file
SceneDatabase
db
=
SceneDatabase
.
getInstance
();
ResultSet
rs
=
db
.
placeCustomQuery
(
"select entityid from scenes where datasetid=250;"
);
Set
<
String
>
dbEntityIds
=
new
HashSet
<>();
while
(
rs
.
next
())
{
String
entityid
=
rs
.
getString
(
1
);
dbEntityIds
.
add
(
entityid
.
substring
(
0
,
entityid
.
length
()
-
2
));
}
System
.
out
.
println
(
dbEntityIds
.
size
()
+
" scenes in db"
);
// Set<String> csvEntityIds = new HashSet<>();
int
matchCount
=
0
;
int
noMatchCount
=
0
;
Scanner
s
=
new
Scanner
(
Paths
.
get
(
"/home/eggert/Downloads/LANDSAT_8_C1.csv"
));
// skip header
s
.
nextLine
();
while
(
s
.
hasNext
())
{
String
[]
lineSplit
=
s
.
nextLine
().
split
(
","
);
String
entityid
=
lineSplit
[
2
];
entityid
=
entityid
.
substring
(
0
,
entityid
.
length
()
-
2
);
if
(
dbEntityIds
.
contains
(
entityid
))
{
// match found
dbEntityIds
.
remove
(
entityid
);
++
matchCount
;
}
else
{
// csvEntityIds.add(entityid);
++
noMatchCount
;
}
}
s
.
close
();
System
.
out
.
println
(
dbEntityIds
.
size
()
+
" unmatched scenes in db"
);
System
.
out
.
println
(
noMatchCount
+
" unmatched scenes in csv"
);
System
.
out
.
println
(
matchCount
+
" matching scenes in db and csv"
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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