Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
aacd94a1
Commit
aacd94a1
authored
14 years ago
by
Arthur Coolen
Browse files
Options
Downloads
Patches
Plain Diff
Bug 768: lofarutils for DMS/RAD etc changed to accept negative degrees
parent
7a24071b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
JAVA/LofarUtils/src/nl/astron/lofar/lofarutils/LofarUtils.java
+9
-7
9 additions, 7 deletions
...LofarUtils/src/nl/astron/lofar/lofarutils/LofarUtils.java
with
9 additions
and
7 deletions
JAVA/LofarUtils/src/nl/astron/lofar/lofarutils/LofarUtils.java
+
9
−
7
View file @
aacd94a1
...
...
@@ -563,8 +563,6 @@ public abstract class LofarUtils {
static
public
double
rad2deg
(
double
rad
)
{
double
deg
=
0
;
if
(
rad
<
0
)
return
deg
;
deg
=
rad
*(
360
/(
2
*
Math
.
PI
));
return
deg
;
}
...
...
@@ -578,8 +576,6 @@ public abstract class LofarUtils {
static
public
double
deg2rad
(
double
deg
)
{
double
rad
=
0
;
if
(
deg
<
0
)
return
rad
;
rad
=
deg
/
360
*
2
*
Math
.
PI
;
return
rad
;
}
...
...
@@ -592,6 +588,7 @@ public abstract class LofarUtils {
*/
static
public
String
rad2hms
(
double
rad
)
{
if
(
rad
<
0
)
rad
+=
2
*
Math
.
PI
;
return
(
LofarUtils
.
deg2hms
(
LofarUtils
.
rad2deg
(
rad
)));
}
...
...
@@ -639,7 +636,7 @@ public abstract class LofarUtils {
static
public
String
deg2hms
(
double
deg
)
{
String
hms
=
""
;
if
(
deg
<
0
)
return
hms
;
if
(
deg
<
0
)
deg
+=
360
;
int
h
=
(
int
)
deg
/
15
;
int
m
=
(
int
)
((
deg
-
h
*
15
)/
15
*
60
);
...
...
@@ -681,12 +678,13 @@ public abstract class LofarUtils {
static
public
String
deg2dms
(
double
deg
)
{
String
hms
=
""
;
if
(
deg
<
0
)
return
hms
;
int
d
=
(
int
)
deg
;
int
m
=
(
int
)
((
deg
-
d
)*
60
);
double
s
=
(
deg
-
d
-(
m
/
60
.))*
3600
.;
if
(
m
<
0
)
m
*=-
1
;
if
(
s
<
0
)
s
*=-
1
;
hms
=
Integer
.
toString
(
d
)+
":"
+
Integer
.
toString
(
m
)+
":"
+
Double
.
toString
(
s
);
return
hms
;
}
...
...
@@ -707,6 +705,10 @@ public abstract class LofarUtils {
int
m
=
Integer
.
valueOf
(
v1
[
1
]);
double
s
=
Double
.
valueOf
(
v1
[
2
]);
if
(
d
<
0
)
{
if
(
m
>
0
)
m
*=-
1
;
if
(
s
>
0
)
s
*=-
1
;
}
deg
=
d
+(
m
/
60
.)+(
s
/
3600
.);
return
deg
;
...
...
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