NetCDF格式小试二

int Nc2Log(const char *file, FSAFC_LOGSET_STRUCT *logset, unsigned int start_index, unsigned int data_set_length)
{
    int err;
    /* This will be the netCDF ID for the file and data variable. */
    int ncid;
    int pin_kal_ID,pout_kal_ID,P_p1_kal_ID,I_p1_kal_ID,P_p2_kal_ID,I_p2_kal_ID;

    static float data_in[14400];

    err = nc_open(file, NC_NOWRITE, &ncid);
    if (err == NC_NOERR)
    {
    err = nc_inq_varid(ncid, "pin_kal",  &pin_kal_ID);
    err = nc_inq_varid(ncid, "pout_kal", &pout_kal_ID);
    err = nc_inq_varid(ncid, "P_p1_kal", &P_p1_kal_ID);
    err = nc_inq_varid(ncid, "I_p1_kal", &I_p1_kal_ID);
    err = nc_inq_varid(ncid, "P_p2_kal", &P_p2_kal_ID);
    err = nc_inq_varid(ncid, "I_p2_kal", &I_p2_kal_ID);

    err = nc_get_var_float(ncid, pin_kal_ID,  data_in);
    err = nc_get_var_float(ncid, pout_kal_ID, data_in);
    err = nc_get_var_float(ncid, P_p1_kal_ID, data_in);
    err = nc_get_var_float(ncid, I_p1_kal_ID, data_in);
    err = nc_get_var_float(ncid, P_p2_kal_ID, data_in);
    err = nc_get_var_float(ncid, I_p2_kal_ID, data_in);

        err = nc_close(ncid);

    }
    return 0;
}

你可能感兴趣的:(NetCDF格式小试二)