Skip to content

Commit

Permalink
Further cleanup and refactoring to use print_provenance functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Zuniga authored and Chris Blanton committed Dec 8, 2021
1 parent 1349b2a commit ada43ac
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
9 changes: 3 additions & 6 deletions tools/make_hgrid/make_hgrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -1205,14 +1205,11 @@ int main(int argc, char* argv[])
else
id_arcx = mpp_def_var(fid, "arcx", MPP_CHAR, 1, dimlist, 2, "standard_name", "grid_edge_x_arc_type",
"north_pole", north_pole_arcx );
mpp_def_global_att(fid, "grid_version", grid_version);
//mpp_def_global_att(fid, "code_version", tagname);
if(use_great_circle_algorithm) mpp_def_global_att(fid, "great_circle_algorithm", "TRUE");
if(n>=ntiles_global) mpp_def_global_att(fid, "nest_grids", "TRUE");
print_provenance(fid, history);
//mpp_def_global_att(fid, "history", history);

print_provenance_gv_gca(fid, history, grid_version, use_great_circle_algorithm);
if(n>=ntiles_global) mpp_def_global_att(fid, "nest_grids", "TRUE");
mpp_end_def(fid);

for(m=0; m<4; m++) { start[m] = 0; nwrite[m] = 0; }
nwrite[0] = strlen(tilename);
mpp_put_var_value_block(fid, id_tile, start, nwrite, tilename );
Expand Down
18 changes: 6 additions & 12 deletions tools/make_quick_mosaic/make_quick_mosaic.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,7 @@ printf("%15.10f, %15.10f, %15.10f\n", ocean_area[n][i], land_area[n][i]+AREA_RAT
}

fid = mpp_open(lnd_mask_file, MPP_WRITE);
mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history, grid_version);

dims[1] = mpp_def_dim(fid, "nx", nx[n]);
dims[0] = mpp_def_dim(fid, "ny", ny[n]);
Expand Down Expand Up @@ -528,8 +527,7 @@ printf("%15.10f, %15.10f, %15.10f\n", ocean_area[n][i], land_area[n][i]+AREA_RAT
}

fid = mpp_open(ocn_mask_file, MPP_WRITE);
mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history, grid_version);

dims[1] = mpp_def_dim(fid, "nx", nx[n]);
dims[0] = mpp_def_dim(fid, "ny", ny[n]);
Expand Down Expand Up @@ -617,8 +615,7 @@ printf("%15.10f, %15.10f, %15.10f\n", ocean_area[n][i], land_area[n][i]+AREA_RAT

fid = mpp_open(axl_file[n], MPP_WRITE);
sprintf(contact, "atmos_mosaic:%s::land_mosaic:%s", tilename[n], tilename[n]);
mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history, grid_version);

dim_string = mpp_def_dim(fid, "string", STRING);
dim_ncells = mpp_def_dim(fid, "ncells", nxgrid);
Expand Down Expand Up @@ -667,8 +664,7 @@ printf("%15.10f, %15.10f, %15.10f\n", ocean_area[n][i], land_area[n][i]+AREA_RAT
}

fid = mpp_open(axo_file[n], MPP_WRITE);
mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history,grid_version);

sprintf(contact, "atmos_mosaic:%s::ocean_mosaic:%s", tilename[n], tilename[n]);
dim_string = mpp_def_dim(fid, "string", STRING);
Expand Down Expand Up @@ -706,8 +702,7 @@ printf("%15.10f, %15.10f, %15.10f\n", ocean_area[n][i], land_area[n][i]+AREA_RAT
/* write out landXocean exchange grid information */
fid = mpp_open(lxo_file[n], MPP_WRITE);
sprintf(contact, "land_mosaic:%s::ocean_mosaic:%s", tilename[n], tilename[n]);
mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history, grid_version);

dim_string = mpp_def_dim(fid, "string", STRING);
dim_ncells = mpp_def_dim(fid, "ncells", nxgrid);
Expand Down Expand Up @@ -765,8 +760,7 @@ printf("%15.10f, %15.10f, %15.10f\n", ocean_area[n][i], land_area[n][i]+AREA_RAT
}
printf("mosaic_file is %s\n", mosaic_file);
fid = mpp_open(mosaic_file, MPP_WRITE);
mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history, grid_version);

dim_string = mpp_def_dim(fid, "string", STRING);
dim_axo = mpp_def_dim(fid, "nfile_aXo", ntiles);
Expand Down
3 changes: 1 addition & 2 deletions tools/make_solo_mosaic/make_solo_mosaic.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ int main (int argc, char *argv[])

}

mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history, grid_version);

mpp_end_def(fid);

Expand Down
6 changes: 1 addition & 5 deletions tools/make_topog/make_topog.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,7 @@ int main(int argc, char* argv[])
}
mpp_close(m_fid);

mpp_def_global_att(fid, "grid_version", grid_version);
if(use_great_circle_algorithm){
mpp_def_global_att(fid, "great_circle_algorithm", "TRUE");
}
print_provenance(fid, history);
print_provenance_gv_gca(fid, history, grid_version, use_great_circle_algorithm);
mpp_end_def(fid);

if(mpp_pe()==mpp_root_pe() && use_great_circle_algorithm)
Expand Down
3 changes: 1 addition & 2 deletions tools/make_vgrid/make_vgrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ int main(int argc, char* argv[])
dim = mpp_def_dim(fid, "nzv", nk+1);
varid = mpp_def_var(fid, "zeta", NC_DOUBLE, 1, &dim, 2, "standard_name", "vertical_grid_vertex",
"units", "meters");
mpp_def_global_att(fid, "grid_version", grid_version);
print_provenance(fid, history);
print_provenance_gv(fid, history, grid_version);
mpp_end_def(fid);
mpp_put_var_value(fid, varid, zeta);

Expand Down

0 comments on commit ada43ac

Please sign in to comment.