7 void help(int exitcode) {
8 printf("Usage centers [-%%] cluster_file radius_file\n");
9 printf("Table of coordinates and cluster values is written to stdout\n");
17 EPP *cluster_file,*radius_file;
18 int check_max_r (int col,int row, int value) {
19 int r=epp_get(radius_file,col,row);
20 struct center *rec = table+value;
28 int main(int argc,char **argv) {
29 struct option long_options[]={
36 while ((c=getopt_long(argc,argv,"%",long_options,&index))!=-1) {
38 case 2:show_version("centers","$Revision: 1.1 $");
39 case '%':verbose=1;break;
41 default: help(c==1?0:1);
44 cluster_file = open_epp(default_ext(argv[optind],".epp"));
46 fprintf(stderr,"Cannot open file %s\n",
47 default_ext(argv[optind],".epp"));
51 radius_file = open_epp(default_ext(argv[optind],".epp"));
53 fprintf(stderr,"Cannot open file %s\n",
54 default_ext(argv[optind],".epp"));
57 if (!is_aligned(cluster_file,radius_file)) {
58 fprintf(stderr,"Files don't have same coordinate system and cell size\n");
61 table=calloc((cluster_file->max+1),sizeof(struct center));
63 perror("allocating table");
66 install_progress_indicator(verbose?show_percent:check_int);
67 result=clear_progress(for_each_cell(cluster_file,check_max_r));
71 for (i=0;i<=cluster_file->max;i++) {
72 if (table[i].radius) {
73 printf ("%5d,%12g,%12g\n",i,alt_x(cluster_file,table[i].col),
74 alt_yc(cluster_file,table[i].row));