00001 #include <drms.h>
00002
00003 #define GETKEY_ERROR_1 1
00004 #define GETKEY_ERROR_2 2
00005 #define GETKEY_ERROR_3 3
00006 #define GETKEY_ERROR_4 4
00007 #define GETKEY_ERROR_5 5
00008 #define GETKEY_ERROR_6 6
00009 #define GETKEY_ERROR_7 7
00010 #define GETKEY_ERROR_8 8
00011 #define GETKEY_ERROR_9 9
00012 #define GETKEY_ERROR_10 10
00013 #define GETKEY_ERROR_11 11
00014 #define GETKEY_ERROR_12 12
00015 #define GETKEY_ERROR_13 13
00016 #define GETKEY_ERROR_14 14
00017 #define GETKEY_ERROR_15 15
00018 #define GETKEY_ERROR_16 16
00019 #define GETKEY_ERROR_17 17
00020 #define GETKEY_ERROR_18 18
00021 #define GETKEY_ERROR_19 19
00022 #define GETKEY_ERROR_20 20
00023 #define SETKEY_ERROR_1 -1
00024 #define SETKEY_ERROR_2 -2
00025 #define SETKEY_ERROR_3 -3
00026 #define SETKEY_ERROR_4 -4
00027 #define SETKEY_ERROR_5 -5
00028 #define SETKEY_ERROR_6 -6
00029 #define SETKEY_ERROR_7 -7
00030 #define SETKEY_ERROR_8 -8
00031 #define SETKEY_ERROR_9 -9
00032 #define SETKEY_ERROR_10 -10
00033 #define SETKEY_ERROR_11 -11
00034 #define SETKEY_ERROR_12 -12
00035 #define SETKEY_ERROR_13 -13
00036 #define SETKEY_ERROR_14 -14
00037 #define SETKEY_ERROR_15 -15
00038 #define SETKEY_ERROR_16 -16
00039 #define SETKEY_ERROR_17 -17
00040 #define SETKEY_ERROR_18 -18
00041 #define SETKEY_ERROR_19 -19
00042 #define SETKEY_ERROR_20 -20
00043 #define BAD_INSTRUMENT_NAME -99
00044 #define BAD_IMG_PATH -98
00045
00046 #define RADEG (180.0/M_PI)
00047
00048 int iris_isp2wcs(DRMS_Record_t *rs0, DRMS_Record_t *rs1, double scroll)
00049 {
00050 int i, status;
00051
00052
00053
00054 int version = 2;
00055 double
00056 al_fu1 = -0.05000,
00057 al_fu2 = -0.43700,
00058 al_nuv = -0.31800,
00059 be_133 = -0.20000,
00060 be_140 = -0.22400,
00061 be_279 = 0.27400,
00062 be_283 = 0.28600,
00063 be_fsi = 0.28000,
00064 be_mir = -0.21000,
00065 be_fu1 = -1.5000,
00066 be_fu2 = -1.9700,
00067 be_nuv = 1.2600,
00068 cdlt1_f1 = 0.01298,
00069 cdlt1_f2 = 0.01272,
00070 cdlt1_nu = 0.02546,
00071 cdlt2_f1 = 0.16632,
00072 cdlt2_f2 = 0.16632,
00073 cdlt2_nu = 0.16637,
00074 cdlt_133 = 0.16560,
00075 cdlt_140 = 0.16560,
00076 cdlt_279 = 0.16790,
00077 cdlt_283 = 0.16790,
00078 cdlt_fsi = 0.16790,
00079 cdlt_mir = 0.16560,
00080 cpx1_133 = 537.30,
00081 cpx1_140 = 529.32,
00082 cpx1_279 = 504.69,
00083 cpx1_283 = 506.47,
00084 cpx1_fsi = 505.20,
00085 cpx1_fu1 = 219.50,
00086 cpx1_fu2 = 3807.3,
00087 cpx1_mir = 534.00,
00088 cpx1_nuv = 659.30,
00089 cpx2_133 = 524.03,
00090 cpx2_140 = 510.46,
00091 cpx2_279 = 502.91,
00092 cpx2_283 = 502.22,
00093 cpx2_fsi = 504.70,
00094 cpx2_fu1 = 487.92,
00095 cpx2_fu2 = 518.21,
00096 cpx2_mir = 516.70,
00097 cpx2_nuv = 530.35,
00098 cvl1_fu1 = 1334.53,
00099 cvl1_fu2 = 1402.77,
00100 cvl1_nuv = 2798.65,
00101 focus_regcal = -100.00,
00102 focus_xregr1 = -0.0514701,
00103 focus_xregr2 = 0.000248873,
00104 focus_yregr1 = 0.0739689,
00105 focus_yregr2 = -0.00047510,
00106 pzt_off_homea = -250.00,
00107 pzt_off_homeb = -250.00,
00108 pzt_off_homec = -250.00,
00109 pzt_off_pixel = 0.16790,
00110 pzt_off_sjixa = 0.001300,
00111 pzt_off_sjixb = -0.14929,
00112 pzt_off_sjixc = 0.14783,
00113 pzt_off_sjiya = -0.17203,
00114 pzt_off_sjiyb = 0.08709,
00115 pzt_off_sjiyc = 0.08687,
00116 pzt_x_sign = 1.0000,
00117 pzt_y_sign = 1.0000,
00118 sji_ccd_roll_bias = -0.28600,
00119 slit_roll_bias = 0.64600,
00120 slit_rot = 0.64600,
00121 wm1_rmax = 634.80,
00122 wm2_rmax = 628.50,
00123 wm_focus_cal = -100.00,
00124 wm_m1v = 217.875,
00125 wm_offset2 = 113.57,
00126 wm_roll_bias = -0.646,
00127 wm_x_sign = -1.000,
00128 wm_xoff = 103.00,
00129 wm_y_sign = 1.000,
00130 wm_yoff = -92.000;
00131
00132
00133
00134 double
00135 focus_xregr[] = {focus_xregr1, focus_xregr2},
00136 focus_yregr[] = {focus_yregr1, focus_yregr2},
00137 foc_rgcl = focus_regcal;
00138
00139
00140 double focus_temp[] = {wm_focus_cal-foc_rgcl, pow((wm_focus_cal-foc_rgcl),2)};
00141 double wm_focus_cal_x = focus_xregr[0]*focus_temp[0]+focus_xregr[1]*focus_temp[1];
00142 double wm_focus_cal_y = focus_yregr[0]*focus_temp[0]+focus_yregr[1]*focus_temp[1];
00143
00144
00145
00146
00147
00148 char *instrume, *img_path, *iissloop;
00149 int isqpzta, isqpztb, isqpztc;
00150 short iwbpzta, iwbpztb, iwbpztc, igtpoffx, igtpoffy;
00151 float ifmpos, iwm1cpos, iwm2cpos;
00152 short sum1, sum2;
00153 float off1, off2;
00154
00155 instrume = drms_getkey_string(rs0, "INSTRUME", &status);
00156 if (status) return GETKEY_ERROR_1;
00157 img_path = drms_getkey_string(rs0, "IMG_PATH", &status);
00158 if (status) return GETKEY_ERROR_2;
00159 iissloop = drms_getkey_string(rs0, "IISSLOOP", &status);
00160 if (status) return GETKEY_ERROR_3;
00161 isqpzta = drms_getkey_int(rs0, "ISQPZTA", &status);
00162 if (status) return GETKEY_ERROR_4;
00163 isqpztb = drms_getkey_int(rs0, "ISQPZTB", &status);
00164 if (status) return GETKEY_ERROR_5;
00165 isqpztc = drms_getkey_int(rs0, "ISQPZTC", &status);
00166 if (status) return GETKEY_ERROR_6;
00167 iwbpzta = drms_getkey_short(rs0, "IWBPZTA", &status);
00168 if (status) return GETKEY_ERROR_7;
00169 iwbpztb = drms_getkey_short(rs0, "IWBPZTB", &status);
00170 if (status) return GETKEY_ERROR_8;
00171 iwbpztc = drms_getkey_short(rs0, "IWBPZTC", &status);
00172 if (status) return GETKEY_ERROR_9;
00173 igtpoffx = drms_getkey_short(rs0, "IGTPOFFX", &status);
00174 if (status) return GETKEY_ERROR_10;
00175 igtpoffy = drms_getkey_short(rs0, "IGTPOFFY", &status);
00176 if (status) return GETKEY_ERROR_11;
00177 ifmpos = drms_getkey_float(rs0, "IFMPOS", &status);
00178 if (status) return GETKEY_ERROR_12;
00179 iwm1cpos = drms_getkey_float(rs0, "IWM1CPOS", &status);
00180 if (status) return GETKEY_ERROR_13;
00181 iwm2cpos = drms_getkey_float(rs0, "IWM2CPOS", &status);
00182 if (status) return GETKEY_ERROR_14;
00183 sum1 = drms_getkey_short(rs0, "SUMSPTRL", &status);
00184 if (status) return GETKEY_ERROR_15;
00185 sum2 = drms_getkey_short(rs0, "SUMSPAT", &status);
00186 if (status) return GETKEY_ERROR_16;
00187 off1 = (sum1-1.0)/(sum1*2.0);
00188 off2 = (sum2-1.0)/(sum2*2.0);
00189
00190
00191
00192
00193
00194
00195 double roll_angle = scroll;
00196
00197 double garad = (-1.0*slit_rot - scroll)/RADEG;
00198
00199
00200
00201 int pzts[3];
00202 float pzt_off_sjix[3], pzt_off_sjiy[3];
00203
00204 pzts[0] = isqpzta - iwbpzta - pzt_off_homea;
00205 pzts[1] = isqpztb - iwbpztb - pzt_off_homeb;
00206 pzts[2] = isqpztc - iwbpztc - pzt_off_homec;
00207
00208 pzt_off_sjix[0] = pzt_off_sjixa;
00209 pzt_off_sjix[1] = pzt_off_sjixb;
00210 pzt_off_sjix[2] = pzt_off_sjixc;
00211
00212 pzt_off_sjiy[0] = pzt_off_sjiya;
00213 pzt_off_sjiy[1] = pzt_off_sjiyb;
00214 pzt_off_sjiy[2] = pzt_off_sjiyc;
00215
00216
00217 double ccdx=0.0, ccdy=0.0;
00218 for (i=0;i<3;++i) {
00219 ccdx -= (pzt_off_sjix[i]*pzts[i])*pzt_off_pixel*pzt_x_sign;
00220 ccdy -= (pzt_off_sjiy[i]*pzts[i])*pzt_off_pixel*pzt_y_sign;
00221 }
00222
00223
00224
00225
00226 focus_temp[0] = ifmpos - foc_rgcl;
00227 focus_temp[1] = focus_temp[0] * focus_temp[0];
00228 double focusx, focusy;
00229 focusx = focus_temp[0]*focus_xregr[0]+focus_temp[1]*focus_xregr[1] - wm_focus_cal_x;
00230 focusy = focus_temp[0]*focus_yregr[0]+focus_temp[1]*focus_yregr[1] - wm_focus_cal_y;
00231
00232
00233 double ccdx2, ccdy2;
00234 ccdx2 = ccdx - focusx*pzt_off_pixel;
00235 ccdy2 = ccdy - focusy*pzt_off_pixel;
00236
00237
00238 double sth, cth;
00239 sth = sin((slit_roll_bias+sji_ccd_roll_bias)/RADEG);
00240 cth = cos((slit_roll_bias+sji_ccd_roll_bias)/RADEG);
00241 ccdx = ccdx2*cth + ccdy2*sth;
00242 ccdy = -ccdx2*sth + ccdy2*cth;
00243
00244
00245 double fac = 2.*M_PI/240.;
00246 double th1 = fac*(iwm1cpos-wm_m1v);
00247 double th2 = fac*(iwm2cpos-wm_m1v+120.-wm_offset2);
00248 double xwm2 = wm_x_sign*(wm1_rmax*sin(th1) + wm2_rmax*sin(th2));
00249 double ywm2 = wm_y_sign*(wm1_rmax*cos(th1) + wm2_rmax*cos(th2));
00250
00251
00252 sth = sin((slit_roll_bias + wm_roll_bias)/RADEG);
00253 cth = cos((slit_roll_bias + wm_roll_bias)/RADEG);
00254 double xwm = xwm2*cth + ywm2*sth;
00255 double ywm = -xwm2*sth + ywm2*cth;
00256
00257
00258
00259 xwm = xwm + wm_xoff;
00260 ywm = ywm + wm_yoff;
00261
00262
00263 double x2 = xwm + ccdx;
00264 double y2 = ywm + ccdy;
00265
00266
00267
00268
00269
00270
00271
00272
00273 if (strncmp(iissloop,"CLOSED",6)) {
00274
00275 x2 = x2 - igtpoffx*0.01;
00276 y2 = y2 - igtpoffy*0.01;
00277 }
00278
00279
00280 double sroll = sin(roll_angle/RADEG);
00281 double croll = cos(roll_angle/RADEG);
00282 double x = x2*croll + y2*sroll;
00283 double y = -x2*sroll + y2*croll;
00284
00285 double crvalxy[] = {x,y};
00286
00287
00288
00289
00290
00291
00292
00293 float cdelt,alrad,berad,wcsaxes,crpix1,crpix2,crval1,crval2,crval3,cdelt1,cdelt2,cdelt3,berad1,alrad1,ab1cos,pc1_1,pc1_2,pc2_1,pc2_2,pc3_1,pc3_2,crpix1a,crpix2a,crval1a,crval2a,crval3a,cdelt1a,cdelt2a,cdelt3a,berad2,alrad2,ab2cos,pc1_1a,pc1_2a,pc2_1a,pc2_2a,pc3_1a,pc3_2a,lonpole,crpix3,crpix3a,xcen,ycen;
00294 char *ctype1,*ctype2,*ctype3,*cunit1,*cunit2,*cunit3;
00295 char *ctype1a,*ctype2a,*ctype3a,*cunit1a,*cunit2a,*cunit3a;
00296 char *specsys1;
00297 DRMS_Segment_t *segment0;
00298 int naxis1, naxis2;
00299 segment0 = drms_segment_lookupnum(rs0, 0);
00300 naxis1 = segment0->axis[0];
00301 naxis2 = segment0->axis[1];
00302
00303 if (strncmp(instrume,"FUV",3) == 0) {
00304 wcsaxes = 3;
00305 crpix1 = cpx1_fu1/sum1 + off1;
00306 crpix2 = cpx2_fu1/sum2 + off2;
00307
00308 crval1 = cvl1_fu1;
00309 crval2 = crvalxy[1];
00310 crval3 = crvalxy[0];
00311 cdelt1 = cdlt1_f1*sum1;
00312 cdelt2 = cdlt2_f1*sum2;
00313 cdelt3 = cdelt2;
00314 ctype1 = "WAVE";
00315 ctype2 = "HPLT-TAN";
00316 ctype3 = "HPLN-TAN";
00317 cunit1 = "Angstrom";
00318 cunit2 = "arcsec";
00319 cunit3 = cunit2;
00320 berad1 = be_fu1 / RADEG;
00321 alrad1 = al_fu1 / RADEG;
00322 ab1cos = cos(alrad1-berad1);
00323 pc1_1 = cos(berad1) / ab1cos;
00324 pc1_2 = -sin(berad1) / ab1cos * sum2/sum1;
00325 pc2_1 = cos(garad) * sin(alrad1) / ab1cos * sum1/sum2;
00326 pc2_2 = cos(garad) * cos(alrad1) / ab1cos;
00327 pc3_1 = -sin(garad) * sin(alrad1) / ab1cos * sum1/sum2;
00328 pc3_2 = -sin(garad) * cos(alrad1) / ab1cos;
00329 crpix1a = cpx1_fu2/sum1 + off1;
00330 crpix2a = cpx2_fu2/sum2 + off2;
00331
00332 crval1a = cvl1_fu2;
00333 crval2a = crval2;
00334 crval3a = crval3;
00335 cdelt1a = cdlt1_f2*sum1;
00336 cdelt2a = cdlt2_f2*sum2;
00337 cdelt3a = cdelt2a;
00338 ctype1a = ctype1;
00339 ctype2a = ctype2;
00340 ctype3a = ctype3;
00341 cunit1a = cunit1;
00342 cunit2a = cunit2;
00343 cunit3a = cunit3;
00344 berad2 = be_fu2 / RADEG;
00345 alrad2 = al_fu2 / RADEG;
00346 ab2cos = cos(alrad2-berad2);
00347 pc1_1a = cos(berad2) / ab2cos;
00348 pc1_2a = -sin(berad2) / ab2cos * sum2/sum1;
00349 pc2_1a = cos(garad) * sin(alrad2) / ab2cos * sum1/sum2;
00350 pc2_2a = cos(garad) * cos(alrad2) / ab2cos;
00351 pc3_1a = -sin(garad) * sin(alrad2) / ab2cos * sum1/sum2;
00352 pc3_2a = -sin(garad) * cos(alrad2) / ab2cos;
00353 xcen = crval3 + cdelt3*(pc3_1*((naxis1+1)/2. - crpix1) + pc3_2*((naxis2+1)/2. - crpix2));
00354 ycen = crval2 + cdelt2*(pc2_1*((naxis1+1)/2. - crpix1) + pc2_2*((naxis2+1)/2. - crpix2));
00355
00356
00357 } else if (strncmp(instrume,"NUV", 3)==0) {
00358 wcsaxes = 3;
00359 berad = be_nuv / RADEG;
00360 alrad = al_nuv / RADEG;
00361 crpix1 = cpx1_nuv/sum1 + off1;
00362 crpix2 = cpx2_nuv/sum2 + off2;
00363
00364 crval1 = cvl1_nuv;
00365 crval2 = crvalxy[1];
00366 crval3 = crvalxy[0];
00367 cdelt1 = cdlt1_nu*sum1;
00368 cdelt2 = cdlt2_nu*sum2;
00369 cdelt3 = cdelt2;
00370 ctype1 = "WAVE";
00371 ctype2 = "HPLT-TAN";
00372 ctype3 = "HPLN-TAN";
00373 cunit1 = "Angstrom";
00374 cunit2 = "arcsec";
00375 cunit3 = cunit2;
00376 pc1_1 = cos(berad) / cos(alrad-berad);
00377 pc1_2 = -sin(berad) / cos(alrad-berad) * sum2/sum1;
00378 pc2_1 = cos(garad) * sin(alrad) / cos(alrad-berad) * sum1/sum2;
00379 pc2_2 = cos(garad) * cos(alrad) / cos(alrad-berad);
00380 pc3_1 = -sin(garad) * sin(alrad) / cos(alrad-berad) * sum1/sum2;
00381 pc3_2 = -sin(garad) * cos(alrad) / cos(alrad-berad);
00382 crpix1a = crpix1;
00383 crpix2a = crpix2;
00384
00385 crval1a = crval1;
00386 crval2a = crval2;
00387 crval3a = crval3;
00388 cdelt1a = cdelt1;
00389 cdelt2a = cdelt2;
00390 cdelt3a = cdelt3;
00391 ctype1a = ctype1;
00392 ctype2a = ctype2;
00393 ctype3a = ctype3;
00394 cunit1a = cunit1;
00395 cunit2a = cunit2;
00396 cunit3a = cunit3;
00397 pc1_1a = pc1_1;
00398 pc1_2a = pc1_2;
00399 pc2_1a = pc2_1;
00400 pc2_2a = pc2_2;
00401 pc3_1a = pc3_1;
00402 pc3_2a = pc3_2;
00403 xcen = crval3 + cdelt3*(pc3_1*((naxis1+1)/2. - crpix1) + pc3_2*((naxis2+1)/2. - crpix2));
00404 ycen = crval2 + cdelt2*(pc2_1*((naxis1+1)/2. - crpix1) + pc2_2*((naxis2+1)/2. - crpix2));
00405
00406
00407 } else if (strncmp(instrume,"SJI", 3)==0) {
00408 if(strncmp(img_path,"SJI_5000W",9)==0) {
00409
00410
00411 berad = be_fsi / RADEG;
00412 cdelt = cdlt_fsi;
00413 crpix1 = cpx1_fsi;
00414 crpix2 = cpx2_fsi;
00415 } else if(strncmp(img_path,"SJI_1330",8) == 0) {
00416
00417
00418 berad = be_133 / RADEG;
00419 cdelt = cdlt_133;
00420 crpix1 = cpx1_133;
00421 crpix2 = cpx2_133;
00422 } else if(strncmp(img_path,"SJI_2796",8) == 0) {
00423
00424
00425 berad = be_279 / RADEG;
00426 cdelt = cdlt_279;
00427 crpix1 = cpx1_279;
00428 crpix2 = cpx2_279;
00429 } else if(strncmp(img_path,"SJI_1400",8) == 0) {
00430
00431
00432 berad = be_140 / RADEG;
00433 cdelt = cdlt_140;
00434 crpix1 = cpx1_140;
00435 crpix2 = cpx2_140;
00436 } else if(strncmp(img_path,"SJI_2832",8) == 0) {
00437
00438
00439 berad = be_283 / RADEG;
00440 cdelt = cdlt_283;
00441 crpix1 = cpx1_283;
00442 crpix2 = cpx2_283;
00443 } else if(strncmp(img_path,"SJI_1600W",9) == 0) {
00444
00445
00446 berad = be_mir / RADEG;
00447 cdelt = cdlt_mir;
00448 crpix1 = cpx1_mir;
00449 crpix2 = cpx2_mir;
00450 } else
00451 return BAD_IMG_PATH;
00452 wcsaxes = 2;
00453 crpix1 = crpix1/sum1 + off1;
00454 crpix2 = crpix2/sum2 + off2;
00455 crval1 = crvalxy[0];
00456 crval2 = crvalxy[1];
00457
00458
00459 crval3 = 0.0;
00460 cdelt1 = cdelt*sum1;
00461 cdelt2 = cdelt*sum2;
00462 cdelt3 = 0.0;
00463 ctype1 = "HPLN-TAN";
00464 ctype2 = "HPLT-TAN";
00465 ctype3 = "none";
00466 cunit1 = "arcsec";
00467 cunit2 = "arcsec";
00468 cunit3 = "none";
00469 pc1_1 = cos(berad+garad);
00470 pc1_2 = -sin(berad+garad) * sum2/sum1;
00471 pc2_1 = sin(berad+garad) * sum1/sum2;
00472 pc2_2 = cos(berad+garad);
00473 pc3_1 = 0.0;
00474 pc3_2 = 0.0;
00475 crpix1a = crpix1;
00476 crpix2a = crpix2;
00477 crval1a = crval1;
00478 crval2a = crval2;
00479 crval3a = crval3;
00480 cdelt1a = cdelt1;
00481 cdelt2a = cdelt2;
00482 cdelt3a = cdelt3;
00483 ctype1a = ctype1;
00484 ctype2a = ctype2;
00485 ctype3a = ctype3;
00486 cunit1a = cunit1;
00487 cunit2a = cunit2;
00488 cunit3a = cunit3;
00489 pc1_1a = pc1_1;
00490 pc1_2a = pc1_2;
00491 pc2_1a = pc2_1;
00492 pc2_2a = pc2_2;
00493 pc3_1a = pc3_1;
00494 pc3_2a = pc3_2;
00495 xcen = crval1 + cdelt1*(pc1_1*((naxis1+1)/2. - crpix1) + pc1_2*((naxis2+1)/2. - crpix2));
00496 ycen = crval2 + cdelt2*(pc2_1*((naxis1+1)/2. - crpix1) + pc2_2*((naxis2+1)/2. - crpix2));
00497
00498
00499 } else
00500 return BAD_INSTRUMENT_NAME;
00501
00503 if (drms_setkey_int(rs1,"WCSDBVER",version)) return SETKEY_ERROR_1;
00504 if (drms_setkey_int(rs1,"WCSAXES",wcsaxes)) return SETKEY_ERROR_1;
00505 if (drms_setkey_float(rs1,"CRPIX1",crpix1)) return SETKEY_ERROR_2;
00506 if (drms_setkey_float(rs1,"CRPIX2",crpix2)) return SETKEY_ERROR_2;
00507
00508 if (drms_setkey_float(rs1,"CRPIX1A",crpix1a)) return SETKEY_ERROR_2;
00509 if (drms_setkey_float(rs1,"CRPIX2A",crpix2a)) return SETKEY_ERROR_2;
00510
00511 if (drms_setkey_float(rs1,"CDELT1",cdelt1)) return SETKEY_ERROR_3;
00512 if (drms_setkey_float(rs1,"CDELT2",cdelt2)) return SETKEY_ERROR_3;
00513 if (drms_setkey_float(rs1,"CDELT3",cdelt3)) return SETKEY_ERROR_3;
00514 if (drms_setkey_float(rs1,"CDELT1A",cdelt1a)) return SETKEY_ERROR_3;
00515 if (drms_setkey_float(rs1,"CDELT2A",cdelt2a)) return SETKEY_ERROR_3;
00516 if (drms_setkey_float(rs1,"CDELT3A",cdelt3a)) return SETKEY_ERROR_3;
00517 if (drms_setkey_string(rs1,"CUNIT1",cunit1)) return SETKEY_ERROR_4;
00518 if (drms_setkey_string(rs1,"CUNIT2",cunit2)) return SETKEY_ERROR_4;
00519 if (drms_setkey_string(rs1,"CUNIT3",cunit3)) return SETKEY_ERROR_4;
00520 if (drms_setkey_string(rs1,"CUNIT1A",cunit1a)) return SETKEY_ERROR_4;
00521 if (drms_setkey_string(rs1,"CUNIT2A",cunit2a)) return SETKEY_ERROR_4;
00522 if (drms_setkey_string(rs1,"CUNIT3A",cunit3a)) return SETKEY_ERROR_4;
00523 if (drms_setkey_string(rs1,"CTYPE1",ctype1)) return SETKEY_ERROR_5;
00524 if (drms_setkey_string(rs1,"CTYPE2",ctype2)) return SETKEY_ERROR_5;
00525 if (drms_setkey_string(rs1,"CTYPE3",ctype3)) return SETKEY_ERROR_5;
00526 if (drms_setkey_string(rs1,"CTYPE1A",ctype1)) return SETKEY_ERROR_5;
00527 if (drms_setkey_string(rs1,"CTYPE2A",ctype2a)) return SETKEY_ERROR_5;
00528 if (drms_setkey_string(rs1,"CTYPE3A",ctype3a)) return SETKEY_ERROR_5;
00529 if (drms_setkey_float(rs1,"PC1_1",pc1_1)) return SETKEY_ERROR_6;
00530 if (drms_setkey_float(rs1,"PC2_1",pc2_1)) return SETKEY_ERROR_6;
00531 if (drms_setkey_float(rs1,"PC3_1",pc3_1)) return SETKEY_ERROR_6;
00532 if (drms_setkey_float(rs1,"PC1_2",pc1_2)) return SETKEY_ERROR_6;
00533 if (drms_setkey_float(rs1,"PC2_2",pc2_2)) return SETKEY_ERROR_6;
00534 if (drms_setkey_float(rs1,"PC3_2",pc3_2)) return SETKEY_ERROR_6;
00535 if (drms_setkey_float(rs1,"PC1_1A",pc1_1a)) return SETKEY_ERROR_6;
00536 if (drms_setkey_float(rs1,"PC2_1A",pc2_1a)) return SETKEY_ERROR_6;
00537 if (drms_setkey_float(rs1,"PC3_1A",pc3_1a)) return SETKEY_ERROR_6;
00538 if (drms_setkey_float(rs1,"PC1_2A",pc1_2a)) return SETKEY_ERROR_6;
00539 if (drms_setkey_float(rs1,"PC2_2A",pc2_2a)) return SETKEY_ERROR_6;
00540 if (drms_setkey_float(rs1,"PC3_2A",pc3_2a)) return SETKEY_ERROR_6;
00541 if (drms_setkey_float(rs1,"CRVAL1",crval1)) return SETKEY_ERROR_7;
00542 if (drms_setkey_float(rs1,"CRVAL2",crval2)) return SETKEY_ERROR_7;
00543 if (drms_setkey_float(rs1,"CRVAL3",crval3)) return SETKEY_ERROR_7;
00544 if (drms_setkey_float(rs1,"CRVAL1A",crval1a)) return SETKEY_ERROR_7;
00545 if (drms_setkey_float(rs1,"CRVAL2A",crval2a)) return SETKEY_ERROR_7;
00546 if (drms_setkey_float(rs1,"CRVAL3A",crval3a)) return SETKEY_ERROR_7;
00547 if (drms_setkey_float(rs1,"SAT_ROT",scroll)) return SETKEY_ERROR_8;
00548 if (drms_setkey_float(rs1,"XCEN",xcen)) return SETKEY_ERROR_9;
00549 if (drms_setkey_float(rs1,"YCEN",ycen)) return SETKEY_ERROR_9;
00550
00551 return 0;
00552 }