<NME> check_domain_info.c
<BEF> /******************************************************************************
 * @section DESCRIPTION
 *
 * Routines to compare the global domain to the other VIC input files, such as
 * parameter or state files.
 *****************************************************************************/

 #include <vic_driver_shared_image.h>

/******************************************************************************
 * @brief    Check that the cooridnates and dimensions in a netcdf file matches
             the global domain.
 *****************************************************************************/
void
compare_ncdomain_with_global_domain(nameid_struct *nc_nameid)
{
    extern domain_struct global_domain;

    domain_struct        ncfile_domain;

    size_t               i;

    // read the lat lon coordinates info from ncfile
    // (e.g. parameters file or state file)
    ncfile_domain.locations =
        malloc(global_domain.ncells_total *
               sizeof(*(ncfile_domain.locations)));
    check_alloc_status(ncfile_domain.locations, "Memory allocation error.");
    copy_domain_info(&global_domain, &ncfile_domain);
    get_nc_latlon(nc_nameid, &ncfile_domain);

    // using the ncfile_domain, we can compare the values to the global domain.

    // dimension shapes match (lat/lon)
    if (global_domain.n_nx != ncfile_domain.n_nx) {
        log_err("x dimension in parameters file does not match domain");
    }
    if (global_domain.n_ny != ncfile_domain.n_ny) {
        log_err("y dimension in parameters file does not match domain");
    }

    // loop over all grid cells and check that the two domains are identical
    for (i = 0; i < global_domain.ncells_total; i++) {
        // latitude matches
        if (!assert_close_double(ncfile_domain.locations[i].latitude,
                                 global_domain.locations[i].latitude,
                                 0, 0.01)) {
            log_err("latitude in parameter (%lf) file does not match the "
                    "latitude in the domain file (%lf) for gridcell %zu",
                    ncfile_domain.locations[i].latitude,
                    global_domain.locations[i].latitude, i);
        }
        // longitude matches
        if (!assert_close_double(ncfile_domain.locations[i].longitude,
                                 global_domain.locations[i].longitude,
                                 0, 0.01)) {
            log_err("longitude in parameter (%lf) file does not match the "
    // loop over all grid cells and check that the two domains are identical
    for (i = 0; i < global_domain.ncells_total; i++) {
        // mask matches
        if (ncfile_domain.locations[i].run > global_domain.locations[i].run) {
            log_err("parameter file mask for gridcell %zu is zero and the "
                    "domain file specifies that this cell should be run", i);
        }

<MSG> little fix

<DFF> @@ -58,7 +58,7 @@ compare_ncdomain_with_global_domain(char *ncfile)
     // loop over all grid cells and check that the two domains are identical
     for (i = 0; i < global_domain.ncells_total; i++) {
         // mask matches
-        if (ncfile_domain.locations[i].run > global_domain.locations[i].run) {
+        if (ncfile_domain.locations[i].run < global_domain.locations[i].run) {
             log_err("parameter file mask for gridcell %zu is zero and the "
                     "domain file specifies that this cell should be run", i);
         }

{'commit': 'diff --git a/vic/drivers/shared_image/src/check_domain_info.c b/vic/drivers/shared_image/src/check_domain_info.c\nindex 32d6aa61..1095b05a 100644\n--- a/vic/drivers/shared_image/src/check_domain_info.c\n+++ b/vic/drivers/shared_image/src/check_domain_info.c\n@@ -58,7 +58,7 @@ compare_ncdomain_with_global_domain(char *ncfile)\n     // loop over all grid cells and check that the two domains are identical\n     for (i = 0; i < global_domain.ncells_total; i++) {\n         // mask matches\n-        if (ncfile_domain.locations[i].run > global_domain.locations[i].run) {\n+        if (ncfile_domain.locations[i].run < global_domain.locations[i].run) {\n             log_err("parameter file mask for gridcell %zu is zero and the "\n                     "domain file specifies that this cell should be run", i);\n         }\n', 'commit_subject': 'little fix', 'repo_name': 'UW-Hydro/VIC', 'committer': {'name': 'Wietse Franssen', 'email': '1b553c671b57b83d43fda90aa84d6e829822505d@wur.nl', 'time_sec': '1468333180', 'tz_offset': '120', 'date': {'seconds': '1468333180'}}, 'commit_tree': 'c6b1c27ef8e3239fe246eed6acd8bf81f0ca71fb', 'commit_message': 'little fix\n', 'language_name': 'Python', 'license': 'mit', 'hunks': '@@ -58,7 +58,7 @@ compare_ncdomain_with_global_domain(char *ncfile)\n     // loop over all grid cells and check that the two domains are identical\n     for (i = 0; i < global_domain.ncells_total; i++) {\n         // mask matches\n-        if (ncfile_domain.locations[i].run > global_domain.locations[i].run) {\n+        if (ncfile_domain.locations[i].run < global_domain.locations[i].run) {\n             log_err("parameter file mask for gridcell %zu is zero and the "\n                     "domain file specifies that this cell should be run", i);\n         }\n', 'addition_count': 1, 'deletion_count': 1, 'src_file': 'a/vic/drivers/shared_image/src/check_domain_info.c', 'tgt_file': 'b/vic/drivers/shared_image/src/check_domain_info.c', 'file_extension': '.c', 'before_file': '/******************************************************************************\n * @section DESCRIPTION\n *\n * Routines to compare the global domain to the other VIC input files, such as\n * parameter or state files.\n *****************************************************************************/\n\n #include <vic_driver_shared_image.h>\n\n/******************************************************************************\n * @brief    Check that the cooridnates and dimensions in a netcdf file matches\n             the global domain.\n *****************************************************************************/\nvoid\ncompare_ncdomain_with_global_domain(nameid_struct *nc_nameid)\n{\n    extern domain_struct global_domain;\n\n    domain_struct        ncfile_domain;\n\n    size_t               i;\n\n    // read the lat lon coordinates info from ncfile\n    // (e.g. parameters file or state file)\n    ncfile_domain.locations =\n        malloc(global_domain.ncells_total *\n               sizeof(*(ncfile_domain.locations)));\n    check_alloc_status(ncfile_domain.locations, "Memory allocation error.");\n    copy_domain_info(&global_domain, &ncfile_domain);\n    get_nc_latlon(nc_nameid, &ncfile_domain);\n\n    // using the ncfile_domain, we can compare the values to the global domain.\n\n    // dimension shapes match (lat/lon)\n    if (global_domain.n_nx != ncfile_domain.n_nx) {\n        log_err("x dimension in parameters file does not match domain");\n    }\n    if (global_domain.n_ny != ncfile_domain.n_ny) {\n        log_err("y dimension in parameters file does not match domain");\n    }\n\n    // loop over all grid cells and check that the two domains are identical\n    for (i = 0; i < global_domain.ncells_total; i++) {\n        // latitude matches\n        if (!assert_close_double(ncfile_domain.locations[i].latitude,\n                                 global_domain.locations[i].latitude,\n                                 0, 0.01)) {\n            log_err("latitude in parameter (%lf) file does not match the "\n                    "latitude in the domain file (%lf) for gridcell %zu",\n                    ncfile_domain.locations[i].latitude,\n                    global_domain.locations[i].latitude, i);\n        }\n        // longitude matches\n        if (!assert_close_double(ncfile_domain.locations[i].longitude,\n                                 global_domain.locations[i].longitude,\n                                 0, 0.01)) {\n            log_err("longitude in parameter (%lf) file does not match the "\n    // loop over all grid cells and check that the two domains are identical\n    for (i = 0; i < global_domain.ncells_total; i++) {\n        // mask matches\n        if (ncfile_domain.locations[i].run > global_domain.locations[i].run) {\n            log_err("parameter file mask for gridcell %zu is zero and the "\n                    "domain file specifies that this cell should be run", i);\n        }\n', 'message': 'little fix\n', 'author_name': 'Wietse Franssen', 'lang': 'c'}