00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 int check_and_set_key_short (DRMS_Record_t *new, const char *key, short val) {
00033 DRMS_Keyword_t *keywd;
00034 short vreq;
00035 int status;
00036
00037 if (!(keywd = drms_keyword_lookup (new, key, 1))) return 0;
00038 if (keywd->info->recscope != 1) {
00039
00040 drms_setkey_short (new, key, val);
00041 return 0;
00042 }
00043 vreq = drms_getkey_short (new, key, &status);
00044 if (status) {
00045 fprintf (stderr, "Error retrieving value for constant keyword %s\n", key);
00046 return 1;
00047 }
00048 if (vreq != val) {
00049 char format[256];
00050 sprintf (format,
00051 "Error: parameter value %s for keyword %%s\n differs from required value %s\n",
00052 keywd->info->format, keywd->info->format);
00053 fprintf (stderr, format, val, key, vreq);
00054 return 1;
00055 }
00056 return 0;
00057 }
00058
00059 int check_and_set_key_int (DRMS_Record_t *new, const char *key, int val) {
00060 DRMS_Keyword_t *keywd;
00061 int vreq;
00062 int status;
00063
00064 if (!(keywd = drms_keyword_lookup (new, key, 1))) return 0;
00065 if (keywd->info->recscope != 1) {
00066
00067 drms_setkey_int (new, key, val);
00068 return 0;
00069 }
00070 vreq = drms_getkey_int (new, key, &status);
00071 if (status) {
00072 fprintf (stderr, "Error retrieving value for constant keyword %s\n", key);
00073 return 1;
00074 }
00075 if (vreq != val) {
00076 char format[256];
00077 sprintf (format,
00078 "Error: parameter value %s for keyword %%s\n differs from required value %s\n",
00079 keywd->info->format, keywd->info->format);
00080 fprintf (stderr, format, val, key, vreq);
00081 return 1;
00082 }
00083 return 0;
00084 }
00085
00086 int check_and_set_key_longlong (DRMS_Record_t *new, const char *key,
00087 long long val) {
00088 DRMS_Keyword_t *keywd;
00089 long long vreq;
00090 int status;
00091
00092 if (!(keywd = drms_keyword_lookup (new, key, 1))) return 0;
00093 if (keywd->info->recscope != 1) {
00094
00095 drms_setkey_longlong (new, key, val);
00096 return 0;
00097 }
00098 vreq = drms_getkey_longlong (new, key, &status);
00099 if (status) {
00100 fprintf (stderr, "Error retrieving value for constant keyword %s\n", key);
00101 return 1;
00102 }
00103 if (vreq != val) {
00104 char format[256];
00105 sprintf (format,
00106 "Error: parameter value %s for keyword %%s\n differs from required value %s\n",
00107 keywd->info->format, keywd->info->format);
00108 fprintf (stderr, format, val, key, vreq);
00109 return 1;
00110 }
00111 return 0;
00112 }
00113
00114 int check_and_set_key_float (DRMS_Record_t *new, const char *key, float val) {
00115 DRMS_Keyword_t *keywd;
00116 float vreq;
00117 int status;
00118 char sreq[128], sval[128];
00119
00120 if (!(keywd = drms_keyword_lookup (new, key, 1))) return 0;
00121 if (keywd->info->recscope != 1) {
00122
00123 drms_setkey_float (new, key, val);
00124 return 0;
00125 }
00126 vreq = drms_getkey_float (new, key, &status);
00127 if (status) {
00128 fprintf (stderr, "Error retrieving value for constant keyword %s\n", key);
00129 return 1;
00130 }
00131 sprintf (sreq, keywd->info->format, vreq);
00132 sprintf (sval, keywd->info->format, val);
00133 if (strcmp (sreq, sval)) {
00134 char format[256];
00135 sprintf (format,
00136 "Error: parameter value %s for keyword %%s\n differs from required value %s\n",
00137 keywd->info->format, keywd->info->format);
00138 fprintf (stderr, format, val, key, vreq);
00139 return 1;
00140 }
00141 return 0;
00142 }
00143
00144 int check_and_set_key_double (DRMS_Record_t *new, const char *key, double val) {
00145 DRMS_Keyword_t *keywd;
00146 double vreq;
00147 int status;
00148 char sreq[128], sval[128];
00149
00150 if (!(keywd = drms_keyword_lookup (new, key, 1))) return 0;
00151 if (keywd->info->recscope != 1) {
00152
00153 drms_setkey_double (new, key, val);
00154 return 0;
00155 }
00156 vreq = drms_getkey_double (new, key, &status);
00157 if (status) {
00158 fprintf (stderr, "Error retrieving value for constant keyword %s\n", key);
00159 return 1;
00160 }
00161 sprintf (sreq, keywd->info->format, vreq);
00162 sprintf (sval, keywd->info->format, val);
00163 if (strcmp (sreq, sval)) {
00164 char format[256];
00165 sprintf (format,
00166 "Error: parameter value %s for keyword %%s\n differs from required value %s\n",
00167 keywd->info->format, keywd->info->format);
00168 fprintf (stderr, format, val, key, vreq);
00169 return 1;
00170 }
00171 return 0;
00172 }
00173
00174 int check_and_set_key_str (DRMS_Record_t *new, const char *key, char *val) {
00175 DRMS_Keyword_t *keywd;
00176 char *vreq;
00177 int status;
00178
00179 if (!(keywd = drms_keyword_lookup (new, key, 1))) return 0;
00180 if (keywd->info->recscope != 1) {
00181
00182 drms_setkey_string (new, key, val);
00183 return 0;
00184 }
00185 vreq = drms_getkey_string (new, key, &status);
00186 if (status) {
00187 fprintf (stderr, "Error retrieving value for constant keyword %s\n", key);
00188 return 1;
00189 }
00190 if (strcmp (vreq, val)) {
00191 char format[256];
00192 sprintf (format,
00193 "Error: parameter value \"%s\" for keyword %%s\n differs from required value \"%s\"\n",
00194 keywd->info->format, keywd->info->format);
00195 fprintf (stderr, format, val, key, vreq);
00196 return 1;
00197 }
00198 return 0;
00199 }
00200
00201 int check_and_set_key_time (DRMS_Record_t *new, const char *key, TIME tval) {
00202 DRMS_Keyword_t *keywd;
00203 TIME treq;
00204 int status;
00205 char sreq[64], sval[64];
00206
00207 if (!(keywd = drms_keyword_lookup (new, key, 1))) return 0;
00208 if (keywd->info->recscope != 1) {
00209
00210 drms_setkey_time (new, key, tval);
00211 return 0;
00212 }
00213 treq = drms_getkey_time (new, key, &status);
00214 if (status) {
00215 fprintf (stderr, "Error retrieving value for constant keyword %s\n", key);
00216 return 1;
00217 }
00218 sprint_time (sreq, treq, keywd->info->unit, atoi (keywd->info->format));
00219 sprint_time (sval, tval, keywd->info->unit, atoi (keywd->info->format));
00220 if (strcmp (sval, sreq)) {
00221 fprintf (stderr, "Error: parameter value %s for keyword %s\n", sval, key);
00222 fprintf (stderr, " differs from required value %s\n", sreq);
00223 return 1;
00224 }
00225 return 0;
00226 }
00227
00228 int check_and_copy_key (DRMS_Record_t *new, DRMS_Record_t *old,
00229 const char *key) {
00230 DRMS_Keyword_t *oldkey, *newkey, *pkey;
00231 DRMS_Type_t *type;
00232 DRMS_Type_Value_t *value;
00233 int n, status;
00234
00235 if (!(oldkey = drms_keyword_lookup (old, key, 1))) return 0;
00236 if (newkey = drms_keyword_lookup (new, key, 0)) {
00237
00238 if (newkey->info->islink) {
00239 int pkeyct = old->seriesinfo->pidx_num;
00240 type = (DRMS_Type_t *)malloc (pkeyct * sizeof (DRMS_Type_t));
00241 value = (DRMS_Type_Value_t *)malloc (pkeyct * sizeof (DRMS_Type_Value_t));
00242 for (n = 0; n < pkeyct; n++) {
00243 pkey = old->seriesinfo->pidx_keywords[n];
00244 value[n] = drms_getkey (old, pkey->info->name, &type[n], NULL);
00245 }
00246
00247 drms_setlink_dynamic (new, newkey->info->linkname, type, value);
00248 free (type);
00249 free (value);
00250 return 0;
00251 }
00252 } else {
00253 return 0;
00254 }
00255
00256 if (oldkey->info->type != newkey->info->type) {
00257
00258
00259
00260
00261 ;
00262
00263
00264
00265 }
00266 if (newkey->info->recscope != 1) {
00267
00268
00269 drms_copykey (new, old, key);
00270 return 0;
00271 }
00272 switch (newkey->info->type) {
00273
00274
00275
00276
00277
00278 case DRMS_TYPE_SHORT:
00279 return check_and_set_key_short (new, key,
00280 drms_getkey_short (old, key, &status));
00281 case DRMS_TYPE_INT:
00282 return check_and_set_key_int (new, key,
00283 drms_getkey_int (old, key, &status));
00284
00285
00286
00287
00288
00289 case DRMS_TYPE_FLOAT:
00290 return check_and_set_key_float (new, key,
00291 drms_getkey_float (old, key, &status));
00292 case DRMS_TYPE_DOUBLE:
00293 return check_and_set_key_double (new, key,
00294 drms_getkey_double (old, key, &status));
00295 case DRMS_TYPE_TIME:
00296 return check_and_set_key_time (new, key,
00297 drms_getkey_time (old, key, &status));
00298 case DRMS_TYPE_STRING:
00299 return check_and_set_key_str (new, key,
00300 drms_getkey_string (old, key, &status));
00301 default:
00302 fprintf (stderr,
00303 "Error in check_and_copy_key(): Unknown type %s for keyword %s\n",
00304 drms_type2str (newkey->info->type), key);
00305 return 1;
00306 }
00307 }
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317 int construct_stringlist (const char *request, char token, char ***stringlist) {
00318 int keyct = 1;
00319 int m, n;
00320 char *req, *req0 = strdup (request);
00321 char c;
00322
00323 req = req0;
00324 while (c = *req) {
00325 if (c == token) {
00326 *req = '\0';
00327 keyct++;
00328 }
00329 req++;
00330 }
00331 *stringlist = (char **)malloc (keyct * sizeof (char **));
00332 req = req0;
00333 for (n = 0; n < keyct; n++) {
00334 (*stringlist)[n] = strdup (req);
00335 req += strlen (req) + 1;
00336 }
00337 for (n = 0; n < keyct; n++) {
00338 char *subs = (*stringlist)[n];
00339
00340 while (isspace (c = *subs)) subs++;
00341 (*stringlist)[n] = subs;
00342
00343 if (strlen (subs)) {
00344 subs += strlen (subs) - 1;
00345 while (isspace (c = *subs)) {
00346 *subs = '\0';
00347 subs--;
00348 }
00349 }
00350 }
00351
00352 for (n = 0; n < keyct; n++) {
00353 if (!strlen ((*stringlist)[n])) {
00354 for (m = n; m < keyct - 1; m++)
00355 (*stringlist)[m] = (*stringlist)[m + 1];
00356 keyct--;
00357 }
00358 }
00359 free (req0);
00360 return keyct;
00361 }
00362
00363 int copy_prime_keys (DRMS_Record_t *new, DRMS_Record_t *old) {
00364
00365
00366
00367
00368 DRMS_Keyword_t *pkey;
00369 int n, kstat = 0;
00370 char *key, *pkeyindex;
00371 int pkeyct = new->seriesinfo->pidx_num;
00372
00373 for (n = 0; n < pkeyct; n++) {
00374 pkey = new->seriesinfo->pidx_keywords[n];
00375 key = strdup (pkey->info->name);
00376
00377 if (pkeyindex = strstr (key, "_index")) *pkeyindex = '\0';
00378 if (!drms_keyword_lookup (old, key, 1)) continue;
00379 kstat += check_and_copy_key (new, old, key);
00380 }
00381 return kstat;
00382 }
00383
00384 void string_insert_escape_char (char **str, const char esc) {
00385 int i, n, ct = 0, len;
00386
00387 len = strlen (*str);
00388 for (n = 0; n < len; n++) if ((*str)[n] == esc) ct++;
00389 if (ct) {
00390 *str = realloc (*str, 2*len);
00391 for (n = len; n < 2*len; n++) (*str)[n] = '\0';
00392 }
00393 for (n = 0; n < len; n++) {
00394 if ((*str)[n] == esc) {
00395 for (i = len; i > n; i--) (*str)[i] = (*str)[i-1];
00396 (*str)[n] = '\\';
00397 len++;
00398 n++;
00399 }
00400 }
00401 }
00402
00403 int append_keyval_to_primekeyval (char **pkey, DRMS_Record_t *rec,
00404 const char *key) {
00405 DRMS_Keyword_t *keywd;
00406 int size;
00407 static int curlen;
00408 char **buf;
00409 int buflen = 256;
00410
00411 if (!*pkey) {
00412 *pkey = calloc (buflen, sizeof (char));
00413 curlen = buflen;
00414 }
00415 size = strlen (*pkey);
00416 if (size) {
00417
00418 size++;
00419 if (size >= curlen) {
00420 char *tmp = calloc (curlen, sizeof (char));
00421 strcpy (tmp, *pkey);
00422 curlen += buflen;
00423 *pkey = realloc (*pkey, curlen);
00424 bzero (*pkey, curlen);
00425 strcpy (*pkey, tmp);
00426 free (tmp);
00427 }
00428 strcat (*pkey, "|");
00429 }
00430 if (!(keywd = drms_keyword_lookup (rec, key, 1))) {
00431 fprintf (stderr, "create_primekey_from_keylist(): %s not found\n", key);
00432 if (*pkey) free (*pkey);
00433 *pkey = NULL;
00434 return 1;
00435 }
00436 buf = malloc (sizeof (char **));
00437 *buf = malloc (DRMS_DEFVAL_MAXLEN * sizeof (char *));
00438 drms_keyword_snprintfval (keywd, *buf, DRMS_DEFVAL_MAXLEN);
00439 if (keywd->info->type == DRMS_TYPE_STRING ||
00440 keywd->info->type == DRMS_TYPE_TIME) {
00441 string_insert_escape_char (buf, '|');
00442 }
00443 size += strlen (*buf);
00444 if (size >= curlen) {
00445 curlen += buflen;
00446 *pkey = realloc (*pkey, curlen);
00447 }
00448 strncat (*pkey, *buf, strlen (*buf));
00449 free (*buf);
00450 free (buf);
00451 return 0;
00452 }
00453
00454 char *create_primekey_from_keylist (DRMS_Record_t *rec, char **keylist,
00455 int keyct) {
00456 char *pkey = NULL;
00457 int n;
00458 for (n = 0; n < keyct; n++)
00459 if (append_keyval_to_primekeyval (&pkey, rec, keylist[n])) break;
00460
00461 return pkey;
00462 }
00463
00464 int propagate_keys (DRMS_Record_t *to, DRMS_Record_t *from, char **keylist,
00465 int keyct) {
00466 int n, status = 0;
00467 for (n = 0; n < keyct; n++)
00468 status += check_and_copy_key (to, from, keylist[n]);
00469 return status;
00470 }
00471
00472 char *iau_units_parse_unit (char *unit, double *scale) {
00473 char prefix = unit[0];
00474
00475 *scale = 1.0;
00476 switch (prefix) {
00477 case ('y'):
00478 if (strcmp (unit, "yr")) {
00479 *scale = 1.0e24;
00480 return &unit[1];
00481 } else return unit;
00482 case ('z'): *scale = 1.0e21; return &unit[1];
00483 case ('a'):
00484 if (strlen (unit) == 1) return unit;
00485 if (strcmp (unit, "arcmin") && strcmp (unit, "arcsec") &&
00486 strcmp (unit, "adu")) {
00487 *scale = 1.0e18;
00488 return &unit[1];
00489 } else return unit;
00490 case ('f'): *scale = 1.0e15; return &unit[1];
00491 case ('p'):
00492 if (strcmp (unit, "pc") && strcmp (unit, "ph") && strcmp (unit, "photon")
00493 && strcmp (unit, "pix") && strcmp (unit, "pixel") ) {
00494 *scale = 1.0e12;
00495 return &unit[1];
00496 } else return unit;
00497 case ('n'): *scale = 1.0e9; return &unit[1];
00498 case ('u'): *scale = 1.0e6; return &unit[1];
00499 case ('m'):
00500 if (strlen (unit) == 1) return unit;
00501 if (strcmp (unit, "mol") && strcmp (unit, "mas") && strcmp (unit, "min")
00502 && strcmp (unit, "mag")) {
00503 *scale = 1.0e3;
00504 return &unit[1];
00505 } else return unit;
00506 case ('c'):
00507 if (strcmp (unit, "cd") && strcmp (unit, "count") && strcmp (unit, "ct")
00508 && strcmp (unit, "chan")) {
00509 *scale = 1.0e2;
00510 return &unit[1];
00511 } else return unit;
00512 case ('d'):
00513 if (strlen (unit) == 1) return unit;
00514 if (strcmp (unit, "deg")) {
00515 *scale = 1.0e1;
00516 return &unit[1];
00517 } else return unit;
00518 case ('h'):
00519 if (strlen (unit) == 1) return unit;
00520 else {
00521 *scale = 1.0e-2;
00522 return &unit[1];
00523 }
00524 case ('k'):
00525 if (strcmp (unit, "kg") && strcmp (unit, "count") && strcmp (unit, "ct")
00526 && strcmp (unit, "chan")) {
00527 *scale = 1.0e-3;
00528 return &unit[1];
00529 } else return unit;
00530 case ('M'): *scale = 1.0e-6; return &unit[1];
00531 case ('G'):
00532 if (strlen (unit) == 1) return unit;
00533 else {
00534 *scale = 1.0e-9;
00535 return &unit[1];
00536 }
00537 case ('T'):
00538 if (strlen (unit) == 1) return unit;
00539 else {
00540 *scale = 1.0e-12;
00541 return &unit[1];
00542 }
00543 case ('P'):
00544 if (strcmp (unit, "PA")) {
00545 *scale = 1.0e-15;
00546 return &unit[1];
00547 } else return unit;
00548 case ('E'): *scale = 1.0e-18; return &unit[1];
00549 case ('Z'): *scale = 1.0e-21; return &unit[1];
00550 case ('Y'): *scale = 1.0e-24; return &unit[1];
00551 default: return unit;
00552 }
00553 }
00554
00555 int drms_iau_units_scale (char *unit, double *scale) {
00556 if (!(strcmp (unit, "rad"))) *scale = 1.0;
00557 else return -1;
00558 return 0;
00559 }
00560
00561 int drms_wcs_timestep (DRMS_Record_t *rec, int axis, double *tstep) {
00562 double dval;
00563 int status;
00564 char *sval;
00565 char delta[9], unit[9];
00566
00567 *tstep = 1.0 / 0.0;
00568 sprintf (delta, "CDELT%d", axis);
00569 sprintf (unit, "CUNIT%d", axis);
00570 dval = drms_getkey_double (rec, delta, &status);
00571 if (status || isnan (dval)) return 1;
00572 *tstep = dval;
00573 sval = drms_getkey_string (rec, unit, &status);
00574
00575 if (status || !sval) {
00576 fprintf (stderr, "Warning: no keyword %s: \"s\" assumed\n", unit);
00577 return 0;
00578 }
00579 if (!strcmp (sval, "s")) return 0;
00580 if (!strcmp (sval, "min")) {
00581 *tstep *= 60.0;
00582 return 0;
00583 }
00584 if (!strcmp (sval, "h")) {
00585 *tstep *= 3600.0;
00586 return 0;
00587 }
00588 if (!strcmp (sval, "d")) {
00589 *tstep *= 86400.0;
00590 return 0;
00591 }
00592 if (!strcmp (sval, "a") || !strcmp (sval, "yr")) {
00593 *tstep *= 31557600.0;
00594 return 0;
00595 }
00596
00597 if (!strcmp (sval, "ns")) {
00598 *tstep *= 1.0e-9;
00599 return 0;
00600 }
00601 if (!strcmp (sval, "us")) {
00602 *tstep *= 1.0e-6;
00603 return 0;
00604 }
00605 if (!strcmp (sval, "ms")) {
00606 *tstep *= 0.001;
00607 return 0;
00608 }
00609 if (!strcmp (sval, "cs")) {
00610 *tstep *= 0.01;
00611 return 0;
00612 }
00613 if (!strcmp (sval, "ds")) {
00614 *tstep *= 0.1;
00615 return 0;
00616 }
00617 if (!strcmp (sval, "das")) {
00618 *tstep *= 10.0;
00619 return 0;
00620 }
00621 if (!strcmp (sval, "hs")) {
00622 *tstep *= 100.0;
00623 return 0;
00624 }
00625 if (!strcmp (sval, "ks")) {
00626 *tstep *= 1000.0;
00627 return 0;
00628 }
00629 if (!strcmp (sval, "Ms")) {
00630 *tstep *= 1.0e6;
00631 return 0;
00632 }
00633 if (!strcmp (sval, "gs")) {
00634 *tstep *= 1.0e9;
00635 return 0;
00636 }
00637
00638 if (!strcmp (sval, "nmin")) {
00639 *tstep *= 6.0e-8;
00640 return 0;
00641 }
00642 if (!strcmp (sval, "umin")) {
00643 *tstep *= 6.0e-5;
00644 return 0;
00645 }
00646 if (!strcmp (sval, "mmin")) {
00647 *tstep *= 0.06;
00648 return 0;
00649 }
00650 if (!strcmp (sval, "cmin")) {
00651 *tstep *= 0.6;
00652 return 0;
00653 }
00654 if (!strcmp (sval, "dmin")) {
00655 *tstep *= 6.0;
00656 return 0;
00657 }
00658 if (!strcmp (sval, "damin")) {
00659 *tstep *= 600.0;
00660 return 0;
00661 }
00662 if (!strcmp (sval, "hmin")) {
00663 *tstep *= 6000.0;
00664 return 0;
00665 }
00666 if (!strcmp (sval, "kmin")) {
00667 *tstep *= 60000.0;
00668 return 0;
00669 }
00670 if (!strcmp (sval, "Mmin")) {
00671 *tstep *= 6.0e7;
00672 return 0;
00673 }
00674 if (!strcmp (sval, "gmin")) {
00675 *tstep *= 6.0e10;
00676 return 0;
00677 }
00678
00679 if (!strcmp (sval, "nh")) {
00680 *tstep *= 3.6e-6;
00681 return 0;
00682 }
00683 if (!strcmp (sval, "uh")) {
00684 *tstep *= 3.6e-3;
00685 return 0;
00686 }
00687 if (!strcmp (sval, "mh")) {
00688 *tstep *= 0.36;
00689 return 0;
00690 }
00691 if (!strcmp (sval, "ch")) {
00692 *tstep *= 3.6;
00693 return 0;
00694 }
00695 if (!strcmp (sval, "dh")) {
00696 *tstep *= 360.0;
00697 return 0;
00698 }
00699 if (!strcmp (sval, "dah")) {
00700 *tstep *= 3.6e4;
00701 return 0;
00702 }
00703 if (!strcmp (sval, "hh")) {
00704 *tstep *= 3.6e5;
00705 return 0;
00706 }
00707 if (!strcmp (sval, "kh")) {
00708 *tstep *= 3.6e6;
00709 return 0;
00710 }
00711 if (!strcmp (sval, "Mh")) {
00712 *tstep *= 3.6e9;
00713 return 0;
00714 }
00715 if (!strcmp (sval, "gh")) {
00716 *tstep *= 3.6e12;
00717 return 0;
00718 }
00719
00720 if (!strcmp (sval, "nd")) {
00721 *tstep *= 8.64e-5;
00722 return 0;
00723 }
00724 if (!strcmp (sval, "ud")) {
00725 *tstep *= 8.64-2;
00726 return 0;
00727 }
00728 if (!strcmp (sval, "md")) {
00729 *tstep *= 86.4;
00730 return 0;
00731 }
00732 if (!strcmp (sval, "cd")) {
00733 *tstep *= 864.0;
00734 return 0;
00735 }
00736 if (!strcmp (sval, "dd")) {
00737 *tstep *= 8640.0;
00738 return 0;
00739 }
00740 if (!strcmp (sval, "dad")) {
00741 *tstep *= 8.64e5;
00742 return 0;
00743 }
00744 if (!strcmp (sval, "hd")) {
00745 *tstep *= 8.64e6;
00746 return 0;
00747 }
00748 if (!strcmp (sval, "kd")) {
00749 *tstep *= 8.64e7;
00750 return 0;
00751 }
00752 if (!strcmp (sval, "Md")) {
00753 *tstep *= 8.64e10;
00754 return 0;
00755 }
00756 if (!strcmp (sval, "gd")) {
00757 *tstep *= 8.64e13;
00758 return 0;
00759 }
00760
00761 fprintf (stderr, "Error: %s type of %s unrecognized by drms_wcs_timestep()\n",
00762 unit, sval);
00763 return 1;
00764 }
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781