Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vlkb-soda
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ViaLactea
vlkb-soda
Commits
0586fc08
Commit
0586fc08
authored
1 year ago
by
Robert Butora
Browse files
Options
Downloads
Patches
Plain Diff
cutout for vlkb: implements nullValuesCount when using 'vlkb' exec
parent
109736d3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
data-access/servlet/src/main/java/datasets/Cutout.java
+1
-1
1 addition, 1 deletion
data-access/servlet/src/main/java/datasets/Cutout.java
data-access/servlet/src/main/java/datasets/CutoutImpl.java
+88
-42
88 additions, 42 deletions
data-access/servlet/src/main/java/datasets/CutoutImpl.java
with
89 additions
and
43 deletions
data-access/servlet/src/main/java/datasets/Cutout.java
+
1
−
1
View file @
0586fc08
...
@@ -19,7 +19,7 @@ public interface Cutout
...
@@ -19,7 +19,7 @@ public interface Cutout
public
CutResult
doFile
(
String
relPathname
,
int
hdunum
,
Pos
pos
,
Band
band
,
Time
time
,
Pol
pol
,
public
CutResult
doFile
(
String
relPathname
,
int
hdunum
,
Pos
pos
,
Band
band
,
Time
time
,
Pol
pol
,
boolean
countNullValues
,
FitsCard
[]
extraCards
)
boolean
countNullValues
,
FitsCard
[]
extraCards
)
throws
IOException
,
InterruptedException
;
throws
IOException
,
InterruptedException
;
;
}
}
This diff is collapsed.
Click to expand it.
data-access/servlet/src/main/java/datasets/CutoutImpl.java
+
88
−
42
View file @
0586fc08
...
@@ -47,14 +47,6 @@ class CutoutImpl implements Cutout
...
@@ -47,14 +47,6 @@ class CutoutImpl implements Cutout
this
.
settings
=
settings
;
this
.
settings
=
settings
;
}
}
/*
public DatasetsImpl(Settings settings, Subsurvey[] subsurveys)
{
LOGGER.info("trace DatasetsImpl(settings, subsurveys)");
this.settings = settings;
this.subsurveys = subsurveys;
}
*/
private
String
genRegionForVlkbOverlapCmd
(
Pos
pos
,
Band
band
)
private
String
genRegionForVlkbOverlapCmd
(
Pos
pos
,
Band
band
)
{
{
...
@@ -182,6 +174,55 @@ class CutoutImpl implements Cutout
...
@@ -182,6 +174,55 @@ class CutoutImpl implements Cutout
}
}
private
NullValueCount
doCountNullValues
(
String
absPathname
,
int
hdunum
)
throws
IOException
,
InterruptedException
{
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
if
(
bos
==
null
)
throw
new
AssertionError
(
"byte output stream for bounds was not created, is null"
);
String
[]
cmdBounds
=
new
String
[
3
];
cmdBounds
[
0
]
=
"/usr/local/bin/vlkb"
;
cmdBounds
[
1
]
=
"nullvals"
;
cmdBounds
[
2
]
=
absPathname
;
ExecCmd
exec
=
new
ExecCmd
();
exec
.
doRun
(
bos
,
cmdBounds
);
LOGGER
.
info
(
"exec NullVals exitValue: "
+
exec
.
exitValue
);
bos
.
close
();
boolean
hasResult
=
(
exec
.
exitValue
==
0
);
if
(
hasResult
)
{
String
nullValsString
=
new
String
(
bos
.
toByteArray
());
LOGGER
.
info
(
"vlkb nullvals: "
+
nullValsString
);
if
((
nullValsString
!=
null
)
&&
nullValsString
.
trim
().
isEmpty
())
{
throw
new
AssertionError
(
"'vlkb nullvals' returned empty string"
);
}
// parse result: '<fill-ratio> <nullvals-count> <tot-count>'
String
[]
splitStr
=
nullValsString
.
trim
().
split
(
"\\s+"
);
if
(
splitStr
.
length
!=
3
)
throw
new
AssertionError
(
"'vlkb nullvals' did not return 3 numbers but: "
+
nullValsString
);
NullValueCount
nvc
=
new
NullValueCount
();
nvc
.
percent
=
Double
.
parseDouble
(
splitStr
[
0
]);
nvc
.
nullCount
=
Long
.
parseLong
(
splitStr
[
1
]);
nvc
.
totalCount
=
Long
.
parseLong
(
splitStr
[
2
]);
return
nvc
;
}
else
{
throw
new
AssertionError
(
"'vlkb nullvals' exited without results for: "
+
absPathname
);
}
}
public
CutResult
doFile
(
String
relPathname
,
int
hdunum
,
public
CutResult
doFile
(
String
relPathname
,
int
hdunum
,
Pos
pos
,
Band
band
,
Time
time
,
Pol
pol
,
Pos
pos
,
Band
band
,
Time
time
,
Pol
pol
,
boolean
countNullValues
,
FitsCard
[]
extraCards
)
boolean
countNullValues
,
FitsCard
[]
extraCards
)
...
@@ -210,7 +251,12 @@ class CutoutImpl implements Cutout
...
@@ -210,7 +251,12 @@ class CutoutImpl implements Cutout
if
(
countNullValues
)
if
(
countNullValues
)
{
{
LOGGER
.
info
(
"NullValuesCount not implemented when used with Cutout::doStream()"
);
cutResult
.
nullValueCount
=
doCountNullValues
(
absSubimgPathname
,
1
);
}
if
(
extraCards
==
null
||
(
extraCards
.
length
<
1
))
{
LOGGER
.
info
(
"Adding extraCards to cut-file not implemented when using 'vlkb' exec (implemented in engine vlkbd/AMQP)"
);
}
}
}
}
else
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment