00001
00002
00003
00004
00005
00006
00007
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifdef HAVE_CONFIG_H
00056 #include <config.h>
00057 #endif
00058
00060 #define _GNU_SOURCE
00061
00062
00063 #ifdef HAVE_SYS_TYPES_H
00064 #include <sys/types.h>
00065 #endif
00066 #ifdef HAVE_SYS_STAT_H
00067 #include <sys/stat.h>
00068 #endif
00069 #ifdef HAVE_FCNTL_H
00070 #include <fcntl.h>
00071 #endif
00072 #ifdef HAVE_UNSTD_H
00073 #include <unistd.h>
00074 #endif
00075 #ifdef HAVE_STDIO_H
00076 #include <stdio.h>
00077 #endif
00078 #ifdef HAVE_STRING_H
00079 #include <string.h>
00080 #endif
00081 #ifdef HAVE_STDLIB_H
00082 #include <stdlib.h>
00083 #endif
00084 #ifdef HAVE_MATH_H
00085 #include <math.h>
00086 #endif
00087 #ifdef HAVE_TIME_H
00088 #include <time.h>
00089 #endif
00090 #ifdef HAVE_LIBGEN_H
00091 #include <libgen.h>
00092 #endif
00093
00094 #include <zlib.h>
00095 #include <hdf5.h>
00096 #include <netcdf.h>
00097
00098 #include <udunits.h>
00099
00100 #include <utils.h>
00101 #include <filter.h>
00102 #include <clim.h>
00103
00105 void show_usage(char *pgm);
00106 void handle_netcdf_error(int status, int lineno);
00107
00109 int main(int argc, char **argv)
00110 {
00118 int nlat;
00119 int nlon;
00120 int nlat_sub;
00121 int nlon_sub;
00122 int ntime;
00123 int ntime_sub;
00124 int nseason_learn;
00125 int *ntime_learn = NULL;
00126
00127 int *year = NULL;
00128 int *month = NULL;
00129 int *day = NULL;
00130 int *hour = NULL;
00131 int *min = NULL;
00132 double *sec = NULL;
00133
00134 double mean;
00135 double var;
00136
00137 char varname[500];
00138
00139 size_t dimval;
00140
00141 char *filein = NULL;
00142 char *filein_learn = NULL;
00143
00144 int istat, ncinid, ncinid_learn;
00145 int varinid, timeinid, timediminid, loninid, londiminid, latinid, latdiminid;
00146 int seasondiminid_learn;
00147 int *time_learn_dimid = NULL;
00148 int *time_learn_varid = NULL;
00149 nc_type vartype_main;
00150 nc_type vartype_time;
00151 int varndims;
00152 int vardimids[NC_MAX_VAR_DIMS];
00153
00154 size_t start[3];
00155 size_t count[3];
00156
00157 size_t t_len;
00158 size_t t_len_learn;
00159 char *time_units = NULL;
00160 char *time_units_learn = NULL;
00161 char *cal_type = NULL;
00162 char *cal_type_learn = NULL;
00163 ut_system *unitSystem = NULL;
00164 ut_unit *dataunits = NULL;
00165 ut_unit *dataunits_learn = NULL;
00166
00167 double *tas = NULL;
00168 double *tas_sub = NULL;
00169 double *tas_subt = NULL;
00170 double *tas_smean = NULL;
00171 double *timein = NULL;
00172 double *lat = NULL;
00173 double *lon = NULL;
00174 double *lat_sub = NULL;
00175 double *lon_sub = NULL;
00176 double **time_learn = NULL;
00177 double *buftmp = NULL;
00178 int **year_learn = NULL;
00179 int **month_learn = NULL;
00180 int **day_learn = NULL;
00181 int **hour_learn = NULL;
00182 int **min_learn = NULL;
00183 double **sec_learn = NULL;
00184
00185 double minlon = -15.0;
00186 double maxlon = 20.0;
00187 double minlat = 38.0;
00188 double maxlat = 60.0;
00189
00190 int i;
00191 int t;
00192 int season;
00193
00194
00195 (void) banner(basename(argv[0]), "1.0", "BEGIN");
00196
00197
00198 for (i=1; i<argc; i++) {
00199 if ( !strcmp(argv[i], "-h") ) {
00200 (void) show_usage(basename(argv[0]));
00201 (void) banner(basename(argv[0]), "OK", "END");
00202 return 0;
00203 }
00204 else if ( !strcmp(argv[i], "-i") ) {
00205 filein = (char *) malloc((strlen(argv[++i])+1) * sizeof(char));
00206 if (filein == NULL) alloc_error(__FILE__, __LINE__);
00207 (void) strcpy(filein, argv[i]);
00208 }
00209 else if ( !strcmp(argv[i], "-i_learn") ) {
00210 filein_learn = (char *) malloc((strlen(argv[++i])+1) * sizeof(char));
00211 if (filein_learn == NULL) alloc_error(__FILE__, __LINE__);
00212 (void) strcpy(filein_learn, argv[i]);
00213 }
00214 else {
00215 (void) fprintf(stderr, "%s:: Wrong arg %s.\n\n", basename(argv[0]), argv[i]);
00216 (void) show_usage(basename(argv[0]));
00217 (void) banner(basename(argv[0]), "ABORT", "END");
00218 (void) abort();
00219 }
00220 }
00221
00222
00223 ut_set_error_message_handler(ut_ignore);
00224 unitSystem = ut_read_xml(NULL);
00225 ut_set_error_message_handler(ut_write_to_stderr);
00226
00227
00228 printf("%s: Reading info from input file %s.\n", __FILE__, filein);
00229 istat = nc_open(filein, NC_NOWRITE, &ncinid);
00230 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00231
00232 istat = nc_inq_dimid(ncinid, "time", &timediminid);
00233 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00234 istat = nc_inq_dimlen(ncinid, timediminid, &dimval);
00235 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00236 ntime = (int) dimval;
00237
00238 istat = nc_inq_dimid(ncinid, "lat1", &latdiminid);
00239 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00240 istat = nc_inq_dimlen(ncinid, latdiminid, &dimval);
00241 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00242 nlat = (int) dimval;
00243
00244 istat = nc_inq_dimid(ncinid, "lon1", &londiminid);
00245 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00246 istat = nc_inq_dimlen(ncinid, londiminid, &dimval);
00247 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00248 nlon = (int) dimval;
00249
00250 istat = nc_inq_varid(ncinid, "time", &timeinid);
00251 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00252 istat = nc_inq_varid(ncinid, "er40.lat", &latinid);
00253 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00254 istat = nc_inq_varid(ncinid, "er40.lon", &loninid);
00255 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00256
00257 istat = nc_inq_varid(ncinid, "tas", &varinid);
00258 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00259
00261 buftmp = (double *) malloc(nlat * nlon * sizeof(double));
00262 if (buftmp == NULL) alloc_error(__FILE__, __LINE__);
00263 lat = (double *) malloc(nlat * sizeof(double));
00264 if (lat == NULL) alloc_error(__FILE__, __LINE__);
00265 lon = (double *) malloc(nlon * sizeof(double));
00266 if (lon == NULL) alloc_error(__FILE__, __LINE__);
00267
00268 start[0] = 0;
00269 start[1] = 0;
00270 start[2] = 0;
00271 count[0] = (size_t) nlat;
00272 count[1] = (size_t) nlon;
00273 count[2] = 0;
00274
00275
00276 istat = nc_get_vara_double(ncinid, latinid, start, count, buftmp);
00277 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00278
00279 for (i=0; i<nlat; i++)
00280 lat[i] = buftmp[i*nlon];
00281
00282
00283 start[0] = 0;
00284 start[1] = 0;
00285 start[2] = 0;
00286 count[0] = (size_t) nlat;
00287 count[1] = (size_t) nlon;
00288 count[2] = 0;
00289
00290
00291 istat = nc_get_vara_double(ncinid, loninid, start, count, buftmp);
00292 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00293
00294 for (i=0; i<nlon; i++)
00295 lon[i] = buftmp[i];
00296 (void) free(buftmp);
00297
00298
00299 istat = nc_inq_var(ncinid, timeinid, (char *) NULL, &vartype_time, &varndims, vardimids, (int *) NULL);
00300 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00301
00302 if (varndims != 1) {
00303 (void) fprintf(stderr, "Error NetCDF type and/or dimensions.\n");
00304 (void) banner(basename(argv[0]), "ABORT", "END");
00305 (void) abort();
00306 }
00307
00308
00309 start[0] = 0;
00310 count[0] = (size_t) ntime;
00311 timein = malloc(ntime * sizeof(double));
00312 if (timein == NULL) alloc_error(__FILE__, __LINE__);
00313
00314
00315 istat = nc_get_vara_double(ncinid, timeinid, start, count, timein);
00316 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00317
00318
00319 for (t=0; t<ntime; t++)
00320 if (timein[t] != 0.0)
00321 break;
00322 if (t == ntime) {
00323 fprintf(stderr, "WARNING: Time variable values all zero!!! Fixing time variable to index value...\n");
00324 for (t=0; t<ntime; t++)
00325 timein[t] = (double) t;
00326 }
00327
00330
00331 istat = nc_inq_var(ncinid, varinid, (char *) NULL, &vartype_main, &varndims, vardimids, (int *) NULL);
00332 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00333
00334 if (varndims != 3) {
00335 (void) fprintf(stderr, "Error NetCDF type and/or dimensions.\n");
00336 (void) banner(basename(argv[0]), "ABORT", "END");
00337 (void) abort();
00338 }
00339
00340
00341 start[0] = 0;
00342 start[1] = 0;
00343 start[2] = 0;
00344 count[0] = (size_t) ntime;
00345 count[1] = (size_t) nlat;
00346 count[2] = (size_t) nlon;
00347
00348 tas = (double *) calloc(nlat*nlon*ntime, sizeof(double));
00349 if (tas == NULL) alloc_error(__FILE__, __LINE__);
00350
00351
00352 printf("%s: Reading datafrom input file %s.\n", __FILE__, filein);
00353 istat = nc_get_vara_double(ncinid, varinid, start, count, tas);
00354 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00355
00356
00357 istat = nc_inq_attlen(ncinid, timeinid, "units", &t_len);
00358 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00359
00360 time_units = (char *) malloc(t_len + 1);
00361 if (time_units == NULL) alloc_error(__FILE__, __LINE__);
00362
00363 istat = nc_get_att_text(ncinid, timeinid, "units", time_units);
00364 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00365 time_units[t_len] = '\0';
00366
00367
00368 istat = nc_inq_attlen(ncinid, timeinid, "calendar", &t_len);
00369 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00370
00371 cal_type = (char *) malloc(t_len + 1);
00372 if (cal_type == NULL) alloc_error(__FILE__, __LINE__);
00373
00374 istat = nc_get_att_text(ncinid, timeinid, "calendar", cal_type);
00375 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00376 cal_type[t_len] = '\0';
00377
00378
00379
00380
00381 printf("%s: Reading info from input file %s.\n", __FILE__, filein_learn);
00382 istat = nc_open(filein_learn, NC_NOWRITE, &ncinid_learn);
00383 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00384
00385 istat = nc_inq_dimid(ncinid_learn, "season", &seasondiminid_learn);
00386 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00387 istat = nc_inq_dimlen(ncinid_learn, seasondiminid_learn, &dimval);
00388 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00389 nseason_learn = (int) dimval;
00390
00392 time_learn_dimid = malloc(nseason_learn * sizeof(int));
00393 if (time_learn_dimid == NULL) alloc_error(__FILE__, __LINE__);
00394 time_learn_varid = malloc(nseason_learn * sizeof(int));
00395 if (time_learn_varid == NULL) alloc_error(__FILE__, __LINE__);
00396
00397 ntime_learn = malloc(nseason_learn * sizeof(int));
00398 if (ntime_learn == NULL) alloc_error(__FILE__, __LINE__);
00399
00401 time_learn = (double **) malloc(nseason_learn * sizeof(double *));
00402 if (time_learn == NULL) alloc_error(__FILE__, __LINE__);
00403
00404 year_learn = (int **) malloc(nseason_learn * sizeof(int *));
00405 if (year_learn == NULL) alloc_error(__FILE__, __LINE__);
00406 month_learn = (int **) malloc(nseason_learn * sizeof(int *));
00407 if (month_learn == NULL) alloc_error(__FILE__, __LINE__);
00408 day_learn = (int **) malloc(nseason_learn * sizeof(int *));
00409 if (day_learn == NULL) alloc_error(__FILE__, __LINE__);
00410 hour_learn = (int **) malloc(nseason_learn * sizeof(int *));
00411 if (hour_learn == NULL) alloc_error(__FILE__, __LINE__);
00412 min_learn = (int **) malloc(nseason_learn * sizeof(int *));
00413 if (min_learn == NULL) alloc_error(__FILE__, __LINE__);
00414 sec_learn = (double **) malloc(nseason_learn * sizeof(double *));
00415 if (sec_learn == NULL) alloc_error(__FILE__, __LINE__);
00416
00417 for (i=0; i<nseason_learn; i++) {
00418
00420 if (i == 0)
00421 (void) strcpy(varname, "time_aut");
00422 else if (i == 1)
00423 (void) strcpy(varname, "time_hiv");
00424 else if (i == 2)
00425 (void) strcpy(varname, "time_pri");
00426 else if (i == 3)
00427 (void) strcpy(varname, "time_ete");
00428 else
00429 exit(1);
00430 istat = nc_inq_dimid(ncinid_learn, varname, &(time_learn_dimid[i]));
00431 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00432 istat = nc_inq_dimlen(ncinid_learn, time_learn_dimid[i], &dimval);
00433 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00434 ntime_learn[i] = (int) dimval;
00435
00436 istat = nc_inq_varid(ncinid_learn, varname, &(time_learn_varid[i]));
00437 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00438
00439
00440 start[0] = 0;
00441 start[1] = 0;
00442 start[2] = 0;
00443 count[0] = (size_t) ntime_learn[i];
00444 count[1] = (size_t) 0;
00445 count[2] = (size_t) 0;
00446
00447 time_learn[i] = (double *) calloc(ntime_learn[i], sizeof(double));
00448 if (time_learn[i] == NULL) alloc_error(__FILE__, __LINE__);
00449
00450
00451 printf("%s: Reading data from input file %s.\n", __FILE__, filein_learn);
00452 istat = nc_get_vara_double(ncinid_learn, time_learn_varid[i], start, count, time_learn[i]);
00453 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00454
00455
00456
00457 istat = nc_inq_var(ncinid_learn, time_learn_varid[i], (char *) NULL, &vartype_main, &varndims, vardimids, (int *) NULL);
00458 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00459
00460 if (varndims != 1) {
00461 (void) fprintf(stderr, "Error NetCDF type and/or dimensions Line %d.\n", __LINE__);
00462 (void) banner(basename(argv[0]), "ABORT", "END");
00463 (void) abort();
00464 }
00465
00466
00467 istat = nc_inq_attlen(ncinid_learn, time_learn_varid[i], "units", &t_len_learn);
00468 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00469
00470 time_units_learn = (char *) malloc(t_len_learn * sizeof(char));
00471 if (time_units_learn == NULL) alloc_error(__FILE__, __LINE__);
00472
00473 istat = nc_get_att_text(ncinid_learn, time_learn_varid[i], "units", time_units_learn);
00474 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00475 time_units_learn[t_len_learn-2] = '\0';
00476
00477
00478 istat = nc_inq_attlen(ncinid_learn, time_learn_varid[i], "calendar", &t_len_learn);
00479 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00480
00481 cal_type_learn = (char *) malloc(t_len_learn + 1);
00482 if (cal_type_learn == NULL) alloc_error(__FILE__, __LINE__);
00483
00484 istat = nc_get_att_text(ncinid_learn, time_learn_varid[i], "calendar", cal_type_learn);
00485 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00486 cal_type_learn[t_len_learn] = '\0';
00487
00488
00489 year_learn[i] = (int *) malloc(ntime_learn[i] * sizeof(int));
00490 if (year_learn[i] == NULL) alloc_error(__FILE__, __LINE__);
00491 month_learn[i] = (int *) malloc(ntime_learn[i] * sizeof(int));
00492 if (month_learn[i] == NULL) alloc_error(__FILE__, __LINE__);
00493 day_learn[i] = (int *) malloc(ntime_learn[i] * sizeof(int));
00494 if (day_learn[i] == NULL) alloc_error(__FILE__, __LINE__);
00495 hour_learn[i] = (int *) malloc(ntime_learn[i] * sizeof(int));
00496 if (hour_learn[i] == NULL) alloc_error(__FILE__, __LINE__);
00497 min_learn[i] = (int *) malloc(ntime_learn[i] * sizeof(int));
00498 if (min_learn[i] == NULL) alloc_error(__FILE__, __LINE__);
00499 sec_learn[i] = (double *) malloc(ntime_learn[i] * sizeof(double));
00500 if (sec_learn[i] == NULL) alloc_error(__FILE__, __LINE__);
00501
00502 dataunits_learn = ut_parse(unitSystem, time_units_learn, UT_ASCII);
00503
00504 for (t=0; t<ntime_learn[i]; t++)
00505 istat = utCalendar2_cal(time_learn[i][t], dataunits_learn,
00506 &(year_learn[i][t]), &(month_learn[i][t]), &(day_learn[i][t]), &(hour_learn[i][t]),
00507 &(min_learn[i][t]), &(sec_learn[i][t]), cal_type_learn);
00508
00509 (void) free(time_units_learn);
00510 (void) ut_free(dataunits_learn);
00511 (void) free(cal_type_learn);
00512
00513
00514 }
00515
00516
00517
00518 year = (int *) malloc(ntime * sizeof(int));
00519 if (year == NULL) alloc_error(__FILE__, __LINE__);
00520 month = (int *) malloc(ntime * sizeof(int));
00521 if (month == NULL) alloc_error(__FILE__, __LINE__);
00522 day = (int *) malloc(ntime * sizeof(int));
00523 if (day == NULL) alloc_error(__FILE__, __LINE__);
00524 hour = (int *) malloc(ntime * sizeof(int));
00525 if (hour == NULL) alloc_error(__FILE__, __LINE__);
00526 min = (int *) malloc(ntime * sizeof(int));
00527 if (min == NULL) alloc_error(__FILE__, __LINE__);
00528 sec = (double *) malloc(ntime * sizeof(double));
00529 if (sec == NULL) alloc_error(__FILE__, __LINE__);
00530
00531 dataunits = ut_parse(unitSystem, time_units, UT_ASCII);
00532 for (t=0; t<ntime; t++)
00533 istat = utCalendar2_cal(timein[t], dataunits, &(year[t]), &(month[t]), &(day[t]), &(hour[t]), &(min[t]), &(sec[t]), cal_type);
00534 (void) free(time_units);
00535 (void) ut_free(dataunits);
00536 (void) free(cal_type);
00537
00538
00539 (void) extract_subdomain(&tas_sub, &lon_sub, &lat_sub, &nlon_sub, &nlat_sub, tas, lon, lat, minlon, maxlon, minlat, maxlat,
00540 nlon, nlat, ntime);
00541
00542 for (season=0; season<nseason_learn; season++) {
00543
00544 (void) printf("Season=%d\n", season);
00545
00546
00547
00548 (void) sub_period_common(&tas_subt, &ntime_sub, tas_sub, year, month, day, year_learn[season], month_learn[season], day_learn[season],
00549 3, nlon_sub, nlat_sub, ntime, ntime_learn[season]);
00550
00551 tas_smean = (double *) malloc(ntime * sizeof(double));
00552 if (tas_smean == NULL) alloc_error(__FILE__, __LINE__);
00553 (void) mean_field_spatial(tas_smean, tas_sub, (short int *) NULL, nlon_sub, nlat_sub, ntime);
00554
00555
00556 (void) mean_variance_field_spatial(&mean, &var, tas_subt, (short int *) NULL, nlon_sub, nlat_sub, ntime_sub);
00557
00558 (void) printf("Season: %d TAS mean=%lf variance=%lf\n", season, mean, var);
00559
00560 (void) free(tas_subt);
00561 (void) free(tas_smean);
00562 }
00563
00565
00566 istat = ncclose(ncinid);
00567 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00568 istat = ncclose(ncinid_learn);
00569 if (istat != NC_NOERR) handle_netcdf_error(istat, __LINE__);
00570
00571 (void) ut_free_system(unitSystem);
00572
00573 (void) free(time_learn_dimid);
00574 (void) free(time_learn_varid);
00575 (void) free(ntime_learn);
00576 for (i=0; i<nseason_learn; i++) {
00577 (void) free(time_learn[i]);
00578 (void) free(year_learn[i]);
00579 (void) free(month_learn[i]);
00580 (void) free(day_learn[i]);
00581 (void) free(hour_learn[i]);
00582 (void) free(min_learn[i]);
00583 (void) free(sec_learn[i]);
00584 }
00585 (void) free(time_learn);
00586 (void) free(year_learn);
00587 (void) free(month_learn);
00588 (void) free(day_learn);
00589 (void) free(hour_learn);
00590 (void) free(min_learn);
00591 (void) free(sec_learn);
00592
00593 (void) free(tas);
00594 (void) free(tas_sub);
00595 (void) free(lon);
00596 (void) free(lat);
00597 (void) free(lon_sub);
00598 (void) free(lat_sub);
00599 (void) free(timein);
00600 (void) free(filein);
00601 (void) free(filein_learn);
00602
00603
00604 (void) banner(basename(argv[0]), "OK", "END");
00605
00606 return 0;
00607 }
00608
00609
00613 void show_usage(char *pgm) {
00618 (void) fprintf(stderr, "%s: usage:\n", pgm);
00619 (void) fprintf(stderr, "-i: input NetCDF file\n");
00620 (void) fprintf(stderr, "-o: output NetCDF file\n");
00621 (void) fprintf(stderr, "-h: help\n");
00622
00623 }
00624
00625
00626 void handle_netcdf_error(int status, int lineno)
00627 {
00628 if (status != NC_NOERR) {
00629 fprintf(stderr, "Line: %d Error %d: %s\n", lineno, status, nc_strerror(status));
00630 exit(-1);
00631 }
00632 }