//------------------------------------------------------------------------- // // This code was generated by cdf2c to read the netCDF data from the // /janus/ko.cdf file into memory. // // NOTE: The code creates global variables, but you may move the variable // definitions inside the read_netCDF_file procedure if you wish. // The code REQUIRES the netCDF C libraries to run, and assumes that // netcdf.h is in the common include path. DON'T FORGET to link with // -lnetcdf -lsun when you compile the code. // // This file contains the following routines: // // read_netCDF_file - reads the data from the given netCDF file into memory // main - driver for program // // History: // Date Name Action // --------- ------------ ------------------------------------------------- // ?? ??? ?? CIDS Work in Progress. // //------------------------------------------------------------------------- #include // Variable definitions. The comments contain the dimension names. char error_log[1][64]; // error_number, _64_byte_string double a_d_sampling_rate[1050]; // scan_number short a_d_coaddition_factor[1050]; // scan_number double scan_acquisition_time[1050]; // scan_number double scan_duration[1050]; // scan_number double inter_scan_time[1050]; // scan_number double resolution[1050]; // scan_number long actual_scan_number[1050]; // scan_number double total_intensity[1050]; // scan_number char total_intensity_units[26]; double mass_range_min[1050]; // scan_number double mass_range_max[1050]; // scan_number double time_range_min[1050]; // scan_number double time_range_max[1050]; // scan_number long scan_index[1050]; // scan_number long point_count[1050]; // scan_number long flag_count[1050]; // scan_number float mass_values[366072]; // point_number char mass_values_units[4]; double mass_values_scale_factor[1]; char mass_values_long_name[4]; float intensity_values[366072]; // point_number char intensity_values_units[26]; double intensity_values_add_offset[1]; double intensity_values_scale_factor[1]; char intensity_values_long_name[6]; char instrument_name[1][32]; // instrument_number, _32_byte_string char instrument_id[1][32]; // instrument_number, _32_byte_string char instrument_mfr[1][32]; // instrument_number, _32_byte_string char instrument_model[1][32]; // instrument_number, _32_byte_string char instrument_serial_no[1][32]; // instrument_number, _32_byte_string char instrument_sw_version[1][32]; // instrument_number, _32_byte_string char instrument_fw_version[1][32]; // instrument_number, _32_byte_string char instrument_os_version[1][32]; // instrument_number, _32_byte_string char instrument_app_version[1][32]; // instrument_number, _32_byte_string char instrument_comments[1][32]; // instrument_number, _32_byte_string char dataset_completeness[6]; char ms_template_revision[6]; char netcdf_revision[6]; char languages[8]; char dataset_origin[1]; char dataset_owner[1]; char netcdf_file_date_time_stamp[20]; char experiment_title[19]; char experiment_date_time_stamp[20]; char operator_name[1]; char source_file_reference[30]; char source_file_format[12]; char source_file_date_time_stamp[20]; char experiment_type[25]; char sample_state[12]; char test_separation_type[18]; char test_ms_inlet[19]; char test_ionization_mode[16]; char test_ionization_polarity[18]; char test_detector_type[16]; char test_resolution_type[20]; char test_scan_function[10]; char test_scan_direction[3]; char test_scan_law[7]; char raw_data_mass_format[6]; char raw_data_time_format[6]; char raw_data_intensity_format[6]; char units[8]; double scale_factor[1]; double global_mass_min[1]; double global_mass_max[1]; double actual_run_time_length[1]; double actual_delay_time[1]; short raw_data_uniform_sampling_flag[1]; void read_netCDF_file () { //# func_description // This routine reads the data from /janus/ko.cdf into memory. int fd; long start[MAX_NC_VARS]; long end[MAX_NC_VARS]; // Open the netCDF file. fd = ncopen("/janus/ko.cdf", NC_NOWRITE); // Initialize start so all elements are zero. //*********************************************************************** // here is the problem, results in "bzero was not declared in this scope" // tried 'int' 'void' but that didn't work // What is needed here? bzero(start, MAX_NC_VARS * sizeof(long)); // Read in the variables and their attributes. // Read: error_log. end[0] = 1; end[1] = 64; ncvarget(fd, 0, start, end, error_log); // Read: a_d_sampling_rate. end[0] = 1050; ncvarget(fd, 1, start, end, a_d_sampling_rate); // Read: a_d_coaddition_factor. end[0] = 1050; ncvarget(fd, 2, start, end, a_d_coaddition_factor); // Read: scan_acquisition_time. end[0] = 1050; ncvarget(fd, 3, start, end, scan_acquisition_time); // Read: scan_duration. end[0] = 1050; ncvarget(fd, 4, start, end, scan_duration); // Read: inter_scan_time. end[0] = 1050; ncvarget(fd, 5, start, end, inter_scan_time); // Read: resolution. end[0] = 1050; ncvarget(fd, 6, start, end, resolution); // Read: actual_scan_number. end[0] = 1050; ncvarget(fd, 7, start, end, actual_scan_number); // Read: total_intensity. end[0] = 1050; ncvarget(fd, 8, start, end, total_intensity); // Read: total_intensity_units. ncattget(fd, 8, "units", total_intensity_units); // Read: mass_range_min. end[0] = 1050; ncvarget(fd, 9, start, end, mass_range_min); // Read: mass_range_max. end[0] = 1050; ncvarget(fd, 10, start, end, mass_range_max); // Read: time_range_min. end[0] = 1050; ncvarget(fd, 11, start, end, time_range_min); // Read: time_range_max. end[0] = 1050; ncvarget(fd, 12, start, end, time_range_max); // Read: scan_index. end[0] = 1050; ncvarget(fd, 13, start, end, scan_index); // Read: point_count. end[0] = 1050; ncvarget(fd, 14, start, end, point_count); // Read: flag_count. end[0] = 1050; ncvarget(fd, 15, start, end, flag_count); // Read: mass_values. end[0] = 366072; ncvarget(fd, 16, start, end, mass_values); // Read: mass_values_units. ncattget(fd, 16, "units", mass_values_units); // Read: mass_values_scale_factor. ncattget(fd, 16, "scale_factor", mass_values_scale_factor); // Read: mass_values_long_name. ncattget(fd, 16, "long_name", mass_values_long_name); // Read: intensity_values. end[0] = 366072; ncvarget(fd, 17, start, end, intensity_values); // Read: intensity_values_units. ncattget(fd, 17, "units", intensity_values_units); // Read: intensity_values_add_offset. ncattget(fd, 17, "add_offset", intensity_values_add_offset); // Read: intensity_values_scale_factor. ncattget(fd, 17, "scale_factor", intensity_values_scale_factor); // Read: intensity_values_long_name. ncattget(fd, 17, "long_name", intensity_values_long_name); // Read: instrument_name. end[0] = 1; end[1] = 32; ncvarget(fd, 18, start, end, instrument_name); // Read: instrument_id. end[0] = 1; end[1] = 32; ncvarget(fd, 19, start, end, instrument_id); // Read: instrument_mfr. end[0] = 1; end[1] = 32; ncvarget(fd, 20, start, end, instrument_mfr); // Read: instrument_model. end[0] = 1; end[1] = 32; ncvarget(fd, 21, start, end, instrument_model); // Read: instrument_serial_no. end[0] = 1; end[1] = 32; ncvarget(fd, 22, start, end, instrument_serial_no); // Read: instrument_sw_version. end[0] = 1; end[1] = 32; ncvarget(fd, 23, start, end, instrument_sw_version); // Read: instrument_fw_version. end[0] = 1; end[1] = 32; ncvarget(fd, 24, start, end, instrument_fw_version); // Read: instrument_os_version. end[0] = 1; end[1] = 32; ncvarget(fd, 25, start, end, instrument_os_version); // Read: instrument_app_version. end[0] = 1; end[1] = 32; ncvarget(fd, 26, start, end, instrument_app_version); // Read: instrument_comments. end[0] = 1; end[1] = 32; ncvarget(fd, 27, start, end, instrument_comments); // Read in the Global Attributes. // Read: dataset_completeness. ncattget(fd, NC_GLOBAL, "dataset_completeness", dataset_completeness); // Read: ms_template_revision. ncattget(fd, NC_GLOBAL, "ms_template_revision", ms_template_revision); // Read: netcdf_revision. ncattget(fd, NC_GLOBAL, "netcdf_revision", netcdf_revision); // Read: languages. ncattget(fd, NC_GLOBAL, "languages", languages); // Read: dataset_origin. ncattget(fd, NC_GLOBAL, "dataset_origin", dataset_origin); // Read: dataset_owner. ncattget(fd, NC_GLOBAL, "dataset_owner", dataset_owner); // Read: netcdf_file_date_time_stamp. ncattget(fd, NC_GLOBAL, "netcdf_file_date_time_stamp", netcdf_file_date_time_stamp); // Read: experiment_title. ncattget(fd, NC_GLOBAL, "experiment_title", experiment_title); // Read: experiment_date_time_stamp. ncattget(fd, NC_GLOBAL, "experiment_date_time_stamp", experiment_date_time_stamp); // Read: operator_name. ncattget(fd, NC_GLOBAL, "operator_name", operator_name); // Read: source_file_reference. ncattget(fd, NC_GLOBAL, "source_file_reference", source_file_reference); // Read: source_file_format. ncattget(fd, NC_GLOBAL, "source_file_format", source_file_format); // Read: source_file_date_time_stamp. ncattget(fd, NC_GLOBAL, "source_file_date_time_stamp", source_file_date_time_stamp); // Read: experiment_type. ncattget(fd, NC_GLOBAL, "experiment_type", experiment_type); // Read: sample_state. ncattget(fd, NC_GLOBAL, "sample_state", sample_state); // Read: test_separation_type. ncattget(fd, NC_GLOBAL, "test_separation_type", test_separation_type); // Read: test_ms_inlet. ncattget(fd, NC_GLOBAL, "test_ms_inlet", test_ms_inlet); // Read: test_ionization_mode. ncattget(fd, NC_GLOBAL, "test_ionization_mode", test_ionization_mode); // Read: test_ionization_polarity. ncattget(fd, NC_GLOBAL, "test_ionization_polarity", test_ionization_polarity); // Read: test_detector_type. ncattget(fd, NC_GLOBAL, "test_detector_type", test_detector_type); // Read: test_resolution_type. ncattget(fd, NC_GLOBAL, "test_resolution_type", test_resolution_type); // Read: test_scan_function. ncattget(fd, NC_GLOBAL, "test_scan_function", test_scan_function); // Read: test_scan_direction. ncattget(fd, NC_GLOBAL, "test_scan_direction", test_scan_direction); // Read: test_scan_law. ncattget(fd, NC_GLOBAL, "test_scan_law", test_scan_law); // Read: raw_data_mass_format. ncattget(fd, NC_GLOBAL, "raw_data_mass_format", raw_data_mass_format); // Read: raw_data_time_format. ncattget(fd, NC_GLOBAL, "raw_data_time_format", raw_data_time_format); // Read: raw_data_intensity_format. ncattget(fd, NC_GLOBAL, "raw_data_intensity_format", raw_data_intensity_format); // Read: units. ncattget(fd, NC_GLOBAL, "units", units); // Read: scale_factor. ncattget(fd, NC_GLOBAL, "scale_factor", scale_factor); // Read: global_mass_min. ncattget(fd, NC_GLOBAL, "global_mass_min", global_mass_min); // Read: global_mass_max. ncattget(fd, NC_GLOBAL, "global_mass_max", global_mass_max); // Read: actual_run_time_length. ncattget(fd, NC_GLOBAL, "actual_run_time_length", actual_run_time_length); // Read: actual_delay_time. ncattget(fd, NC_GLOBAL, "actual_delay_time", actual_delay_time); // Read: raw_data_uniform_sampling_flag. ncattget(fd, NC_GLOBAL, "raw_data_uniform_sampling_flag", raw_data_uniform_sampling_flag); // Close the netCDF file. ncclose(fd); } // I added 'int' since 'void' was rejected by g++ 12AUG08 int main () { //# func_description // This routine will serve as the driver for all processes affecting // the netCDF data. // Read the netCDF data into memory. read_netCDF_file(); // This is were you should begin adding code to act on the data. }