548
549
static const char *function = "wcssub";
550
551
char *c, ctypei[16];
551
int axis, cubeface, dealloc, dummy, i, itab, j, k, latitude, longitude, m,
552
*map = 0x0, msub, naxis, npv, nps, other, spectral, status, stokes;
552
int axis, cubeface, dealloc, dummy, i, itab, *itmp = 0x0, j, k, latitude,
553
longitude, m, *map, msub, naxis, npv, nps, ntmp, other, spectral,
553
555
const double *srcp;
555
557
struct tabprm *tabp;
978
981
/*--------------------------------------------------------------------------*/
985
const struct wcsprm *wcs1,
986
const struct wcsprm *wcs2,
990
int i, j, naxis, naxis2;
995
if (wcs1 == 0x0) return WCSERR_NULL_POINTER;
996
if (wcs2 == 0x0) return WCSERR_NULL_POINTER;
997
if (equal == 0x0) return WCSERR_NULL_POINTER;
1001
if (wcs1->naxis != wcs2->naxis) {
1005
naxis = wcs1->naxis;
1006
naxis2 = wcs1->naxis*wcs1->naxis;
1008
if (cmp & WCSCOMPARE_CRPIX) {
1009
/* Don't compare crpix. */
1010
} else if (cmp & WCSCOMPARE_TILING) {
1011
for (i = 0; i < naxis; ++i) {
1012
diff = wcs1->crpix[i] - wcs2->crpix[i];
1013
if ((double)(int)(diff) != diff) {
1018
if (!wcsutil_Eq(naxis, wcs1->crpix, wcs2->crpix)) {
1023
if (!wcsutil_Eq(naxis2, wcs1->pc, wcs2->pc) ||
1024
!wcsutil_Eq(naxis, wcs1->cdelt, wcs2->cdelt) ||
1025
!wcsutil_Eq(naxis, wcs1->crval, wcs2->crval) ||
1026
!wcsutil_strEq(naxis, wcs1->cunit, wcs2->cunit) ||
1027
!wcsutil_strEq(naxis, wcs1->ctype, wcs2->ctype) ||
1028
wcs1->lonpole != wcs2->lonpole ||
1029
wcs1->latpole != wcs2->latpole ||
1030
wcs1->restfrq != wcs2->restfrq ||
1031
wcs1->restwav != wcs2->restwav ||
1032
wcs1->npv != wcs2->npv ||
1033
wcs1->nps != wcs2->nps) {
1037
/* Compare pv cards, which may not be in the same order */
1038
for (i = 0; i < wcs1->npv; ++i) {
1039
for (j = 0; j < wcs2->npv; ++j) {
1040
if (wcs1->pv[i].i == wcs2->pv[j].i &&
1041
wcs1->pv[i].m == wcs2->pv[j].m) {
1042
if (wcs1->pv[i].value != wcs2->pv[j].value) {
1048
/* We didn't find a match, so they are not equal */
1049
if (j == wcs2->npv) {
1054
/* Compare ps cards, which may not be in the same order */
1055
for (i = 0; i < wcs1->nps; ++i) {
1056
for (j = 0; j < wcs2->nps; ++j) {
1057
if (wcs1->ps[i].i == wcs2->ps[j].i &&
1058
wcs1->ps[i].m == wcs2->ps[j].m) {
1059
if (strncmp(wcs1->ps[i].value, wcs2->ps[j].value, 72)) {
1065
/* We didn't find a match, so they are not equal */
1066
if (j == wcs2->nps) {
1071
if (wcs1->flag != WCSSET || wcs2->flag != WCSSET) {
1072
if (!wcsutil_Eq(naxis2, wcs1->cd, wcs2->cd) ||
1073
!wcsutil_Eq(naxis, wcs1->crota, wcs2->crota) ||
1074
wcs1->altlin != wcs2->altlin ||
1075
wcs1->velref != wcs2->velref) {
1080
if (!(cmp & WCSCOMPARE_ANCILLARY)) {
1081
if (strncmp(wcs1->alt, wcs2->alt, 4) ||
1082
wcs1->colnum != wcs2->colnum ||
1083
!wcsutil_intEq(naxis, wcs1->colax, wcs2->colax) ||
1084
!wcsutil_strEq(naxis, wcs1->cname, wcs2->cname) ||
1085
!wcsutil_Eq(naxis, wcs1->crder, wcs2->crder) ||
1086
!wcsutil_Eq(naxis, wcs1->csyer, wcs2->csyer) ||
1087
strncmp(wcs1->dateavg, wcs2->dateavg, 72) ||
1088
strncmp(wcs1->dateobs, wcs2->dateobs, 72) ||
1089
wcs1->equinox != wcs2->equinox ||
1090
wcs1->mjdavg != wcs2->mjdavg ||
1091
wcs1->mjdobs != wcs2->mjdobs ||
1092
!wcsutil_Eq(3, wcs1->obsgeo, wcs2->obsgeo) ||
1093
strncmp(wcs1->radesys, wcs2->radesys, 72) ||
1094
strncmp(wcs1->specsys, wcs2->specsys, 72) ||
1095
strncmp(wcs1->ssysobs, wcs2->ssysobs, 72) ||
1096
wcs1->velosys != wcs2->velosys ||
1097
wcs1->zsource != wcs2->zsource ||
1098
strncmp(wcs1->ssyssrc, wcs2->ssyssrc, 72) ||
1099
wcs1->velangl != wcs2->velangl ||
1100
strncmp(wcs1->wcsname, wcs2->wcsname, 72)) {
1105
/* Compare tabular parameters */
1106
if (wcs1->ntab != wcs2->ntab) {
1110
for (i = 0; i < wcs1->ntab; ++i) {
1111
if ((status = tabcmp(0, &wcs1->tab[i], &wcs2->tab[i], &tab_equal))) {
1123
/*--------------------------------------------------------------------------*/
980
1125
int wcsfree(struct wcsprm *wcs)