Home
Manual
Packages
Global Index
Keywords
Quick Reference
|
#include "Chris/aitof.i"
func ad2d (x)
/* DOCUMENT coordinate transformation :
sexadecimal hour angle to decimal degree
for x(,1:3) and sexadecimal to decimal for x(,4:6)
see also : d2ad */
{
if (dimsof(x)(1)==1){
y=x(-:1:2,);
}
else y=x;
ra0=y(,1:3);
de0=y(,4:6);
ra = abs(ra0(,1))+ra0(,2)/60.+ra0(,3)/60.^2;
de = abs(de0(,1))+de0(,2)/60.+de0(,3)/60.^2;
ra =ra*15.*sign(ra0(,1));
de = de*sign(de0(,1));
if (dimsof(x)(1)==1){
return [ra(1),de(1)];
} else {
return[ra,de];
}
}
func d2ad (x)
/* DOCUMENT coordinate transformation : decimal degree
to sexadecimal hour angle for x(,1) and decimal
to sexadecimal for x(,2)
see also : ad2d */
{
if (dimsof(x)(1)==1){
y=x(-:1:2,);
} else y=x;
ra0=y(,1)*3600./15.;
de0=y(,2)*3600.;
radd = long(ra0)/3600;
ramm = long(abs(ra0) -abs(radd)*3600)/60;
rass = (abs(ra0) -abs(radd)*3600. - ramm*60.);
dedd = long(de0 )/3600;
demm = long(abs(de0) -abs(dedd)*3600)/ 60;
dess = (abs(de0) -abs(dedd)*3600. - demm*60.);
if (dimsof(x)(1)==1){
return [radd(1),ramm(1),rass(1),dedd(1),demm(1),dess(1)];
} else {
return [radd,ramm,rass,dedd,demm,dess];
}
}
|