#include #include #include void check_err(const int stat, const int line, const char *file) { if (stat != NC_NOERR) { (void) fprintf(stderr, "line %d of %s: %s\n", line, file, nc_strerror(stat)); exit(1); } } int main() { /* create 20083220000MMCRMom.nc */ int stat; /* return status */ int ncid; /* netCDF id */ /* dimension ids */ int mode_dim; int namelength_dim; int heights_dim; int speclength_dim; int time_dim; /* dimension lengths */ size_t mode_len = 10; size_t namelength_len = 32; size_t heights_len = 120; size_t speclength_len = 128; size_t time_len = NC_UNLIMITED; /* variable ids */ int base_time_id; int time_offset_id; int ModeDescription_id; int RxCalTimeStamp_id; int RxGain_id; int SkyNoiseLevel_id; int Rx290KLevel_id; int CalCheckLevel_id; int CalCheckTime_id; int RadarConstant_id; int MinimumDetectableReflectivity_id; int InterPulsePeriod_id; int PulseWidth_id; int StartGateDelay_id; int GateSpacing_id; int NumCoherentIntegrations_id; int NumSpectralAverages_id; int NumFFT_id; int NumHeights_id; int NumCodeBits_id; int NumReceivers_id; int ReceiverMode_id; int ReceiverNumber_id; int NyquistVelocity_id; int DCFilterONOFF_id; int WindowingONOFF_id; int ClutterHeight_id; int Heights_id; int ModeNum_id; int lat_id; int lon_id; int alt_id; int Azimuth_id; int Elevation_id; int DataQualityStatus_id; int MeanDopplerVelocity_id; int SignalToNoiseRatio_id; int Power_id; int SpectralWidth_id; int NoiseLevel_id; int Reflectivity_id; int RangeCorrectedPower_id; int CircularDepolarizationRatio_id; int AvgNoiseLevel_id; /* rank (number of dimensions) for each variable */ # define RANK_base_time 0 # define RANK_time_offset 1 # define RANK_ModeDescription 2 # define RANK_RxCalTimeStamp 1 # define RANK_RxGain 1 # define RANK_SkyNoiseLevel 1 # define RANK_Rx290KLevel 1 # define RANK_CalCheckLevel 1 # define RANK_CalCheckTime 1 # define RANK_RadarConstant 1 # define RANK_MinimumDetectableReflectivity 2 # define RANK_InterPulsePeriod 1 # define RANK_PulseWidth 1 # define RANK_StartGateDelay 1 # define RANK_GateSpacing 1 # define RANK_NumCoherentIntegrations 1 # define RANK_NumSpectralAverages 1 # define RANK_NumFFT 1 # define RANK_NumHeights 1 # define RANK_NumCodeBits 1 # define RANK_NumReceivers 1 # define RANK_ReceiverMode 1 # define RANK_ReceiverNumber 1 # define RANK_NyquistVelocity 1 # define RANK_DCFilterONOFF 1 # define RANK_WindowingONOFF 1 # define RANK_ClutterHeight 1 # define RANK_Heights 2 # define RANK_ModeNum 1 # define RANK_lat 1 # define RANK_lon 1 # define RANK_alt 1 # define RANK_Azimuth 1 # define RANK_Elevation 1 # define RANK_DataQualityStatus 1 # define RANK_MeanDopplerVelocity 2 # define RANK_SignalToNoiseRatio 2 # define RANK_Power 2 # define RANK_SpectralWidth 2 # define RANK_NoiseLevel 2 # define RANK_Reflectivity 2 # define RANK_RangeCorrectedPower 2 # define RANK_CircularDepolarizationRatio 2 # define RANK_AvgNoiseLevel 1 /* variable shapes */ int time_offset_dims[RANK_time_offset]; int ModeDescription_dims[RANK_ModeDescription]; int RxCalTimeStamp_dims[RANK_RxCalTimeStamp]; int RxGain_dims[RANK_RxGain]; int SkyNoiseLevel_dims[RANK_SkyNoiseLevel]; int Rx290KLevel_dims[RANK_Rx290KLevel]; int CalCheckLevel_dims[RANK_CalCheckLevel]; int CalCheckTime_dims[RANK_CalCheckTime]; int RadarConstant_dims[RANK_RadarConstant]; int MinimumDetectableReflectivity_dims[RANK_MinimumDetectableReflectivity]; int InterPulsePeriod_dims[RANK_InterPulsePeriod]; int PulseWidth_dims[RANK_PulseWidth]; int StartGateDelay_dims[RANK_StartGateDelay]; int GateSpacing_dims[RANK_GateSpacing]; int NumCoherentIntegrations_dims[RANK_NumCoherentIntegrations]; int NumSpectralAverages_dims[RANK_NumSpectralAverages]; int NumFFT_dims[RANK_NumFFT]; int NumHeights_dims[RANK_NumHeights]; int NumCodeBits_dims[RANK_NumCodeBits]; int NumReceivers_dims[RANK_NumReceivers]; int ReceiverMode_dims[RANK_ReceiverMode]; int ReceiverNumber_dims[RANK_ReceiverNumber]; int NyquistVelocity_dims[RANK_NyquistVelocity]; int DCFilterONOFF_dims[RANK_DCFilterONOFF]; int WindowingONOFF_dims[RANK_WindowingONOFF]; int ClutterHeight_dims[RANK_ClutterHeight]; int Heights_dims[RANK_Heights]; int ModeNum_dims[RANK_ModeNum]; int lat_dims[RANK_lat]; int lon_dims[RANK_lon]; int alt_dims[RANK_alt]; int Azimuth_dims[RANK_Azimuth]; int Elevation_dims[RANK_Elevation]; int DataQualityStatus_dims[RANK_DataQualityStatus]; int MeanDopplerVelocity_dims[RANK_MeanDopplerVelocity]; int SignalToNoiseRatio_dims[RANK_SignalToNoiseRatio]; int Power_dims[RANK_Power]; int SpectralWidth_dims[RANK_SpectralWidth]; int NoiseLevel_dims[RANK_NoiseLevel]; int Reflectivity_dims[RANK_Reflectivity]; int RangeCorrectedPower_dims[RANK_RangeCorrectedPower]; int CircularDepolarizationRatio_dims[RANK_CircularDepolarizationRatio]; int AvgNoiseLevel_dims[RANK_AvgNoiseLevel]; /* enter define mode */ stat = nc_create("20083220000MMCRMom.nc", NC_CLOBBER, &ncid); check_err(stat,__LINE__,__FILE__); /* define dimensions */ stat = nc_def_dim(ncid, "mode", mode_len, &mode_dim); check_err(stat,__LINE__,__FILE__); stat = nc_def_dim(ncid, "namelength", namelength_len, &namelength_dim); check_err(stat,__LINE__,__FILE__); stat = nc_def_dim(ncid, "heights", heights_len, &heights_dim); check_err(stat,__LINE__,__FILE__); stat = nc_def_dim(ncid, "speclength", speclength_len, &speclength_dim); check_err(stat,__LINE__,__FILE__); stat = nc_def_dim(ncid, "time", time_len, &time_dim); check_err(stat,__LINE__,__FILE__); /* define variables */ stat = nc_def_var(ncid, "base_time", NC_INT, RANK_base_time, 0, &base_time_id); check_err(stat,__LINE__,__FILE__); time_offset_dims[0] = time_dim; stat = nc_def_var(ncid, "time_offset", NC_DOUBLE, RANK_time_offset, time_offset_dims, &time_offset_id); check_err(stat,__LINE__,__FILE__); ModeDescription_dims[0] = mode_dim; ModeDescription_dims[1] = namelength_dim; stat = nc_def_var(ncid, "ModeDescription", NC_CHAR, RANK_ModeDescription, ModeDescription_dims, &ModeDescription_id); check_err(stat,__LINE__,__FILE__); RxCalTimeStamp_dims[0] = mode_dim; stat = nc_def_var(ncid, "RxCalTimeStamp", NC_INT, RANK_RxCalTimeStamp, RxCalTimeStamp_dims, &RxCalTimeStamp_id); check_err(stat,__LINE__,__FILE__); RxGain_dims[0] = mode_dim; stat = nc_def_var(ncid, "RxGain", NC_FLOAT, RANK_RxGain, RxGain_dims, &RxGain_id); check_err(stat,__LINE__,__FILE__); SkyNoiseLevel_dims[0] = mode_dim; stat = nc_def_var(ncid, "SkyNoiseLevel", NC_FLOAT, RANK_SkyNoiseLevel, SkyNoiseLevel_dims, &SkyNoiseLevel_id); check_err(stat,__LINE__,__FILE__); Rx290KLevel_dims[0] = mode_dim; stat = nc_def_var(ncid, "Rx290KLevel", NC_FLOAT, RANK_Rx290KLevel, Rx290KLevel_dims, &Rx290KLevel_id); check_err(stat,__LINE__,__FILE__); CalCheckLevel_dims[0] = mode_dim; stat = nc_def_var(ncid, "CalCheckLevel", NC_FLOAT, RANK_CalCheckLevel, CalCheckLevel_dims, &CalCheckLevel_id); check_err(stat,__LINE__,__FILE__); CalCheckTime_dims[0] = mode_dim; stat = nc_def_var(ncid, "CalCheckTime", NC_INT, RANK_CalCheckTime, CalCheckTime_dims, &CalCheckTime_id); check_err(stat,__LINE__,__FILE__); RadarConstant_dims[0] = mode_dim; stat = nc_def_var(ncid, "RadarConstant", NC_FLOAT, RANK_RadarConstant, RadarConstant_dims, &RadarConstant_id); check_err(stat,__LINE__,__FILE__); MinimumDetectableReflectivity_dims[0] = mode_dim; MinimumDetectableReflectivity_dims[1] = heights_dim; stat = nc_def_var(ncid, "MinimumDetectableReflectivity", NC_FLOAT, RANK_MinimumDetectableReflectivity, MinimumDetectableReflectivity_dims, &MinimumDetectableReflectivity_id); check_err(stat,__LINE__,__FILE__); InterPulsePeriod_dims[0] = mode_dim; stat = nc_def_var(ncid, "InterPulsePeriod", NC_INT, RANK_InterPulsePeriod, InterPulsePeriod_dims, &InterPulsePeriod_id); check_err(stat,__LINE__,__FILE__); PulseWidth_dims[0] = mode_dim; stat = nc_def_var(ncid, "PulseWidth", NC_INT, RANK_PulseWidth, PulseWidth_dims, &PulseWidth_id); check_err(stat,__LINE__,__FILE__); StartGateDelay_dims[0] = mode_dim; stat = nc_def_var(ncid, "StartGateDelay", NC_INT, RANK_StartGateDelay, StartGateDelay_dims, &StartGateDelay_id); check_err(stat,__LINE__,__FILE__); GateSpacing_dims[0] = mode_dim; stat = nc_def_var(ncid, "GateSpacing", NC_INT, RANK_GateSpacing, GateSpacing_dims, &GateSpacing_id); check_err(stat,__LINE__,__FILE__); NumCoherentIntegrations_dims[0] = mode_dim; stat = nc_def_var(ncid, "NumCoherentIntegrations", NC_INT, RANK_NumCoherentIntegrations, NumCoherentIntegrations_dims, &NumCoherentIntegrations_id); check_err(stat,__LINE__,__FILE__); NumSpectralAverages_dims[0] = mode_dim; stat = nc_def_var(ncid, "NumSpectralAverages", NC_SHORT, RANK_NumSpectralAverages, NumSpectralAverages_dims, &NumSpectralAverages_id); check_err(stat,__LINE__,__FILE__); NumFFT_dims[0] = mode_dim; stat = nc_def_var(ncid, "NumFFT", NC_SHORT, RANK_NumFFT, NumFFT_dims, &NumFFT_id); check_err(stat,__LINE__,__FILE__); NumHeights_dims[0] = mode_dim; stat = nc_def_var(ncid, "NumHeights", NC_SHORT, RANK_NumHeights, NumHeights_dims, &NumHeights_id); check_err(stat,__LINE__,__FILE__); NumCodeBits_dims[0] = mode_dim; stat = nc_def_var(ncid, "NumCodeBits", NC_SHORT, RANK_NumCodeBits, NumCodeBits_dims, &NumCodeBits_id); check_err(stat,__LINE__,__FILE__); NumReceivers_dims[0] = mode_dim; stat = nc_def_var(ncid, "NumReceivers", NC_SHORT, RANK_NumReceivers, NumReceivers_dims, &NumReceivers_id); check_err(stat,__LINE__,__FILE__); ReceiverMode_dims[0] = mode_dim; stat = nc_def_var(ncid, "ReceiverMode", NC_SHORT, RANK_ReceiverMode, ReceiverMode_dims, &ReceiverMode_id); check_err(stat,__LINE__,__FILE__); ReceiverNumber_dims[0] = mode_dim; stat = nc_def_var(ncid, "ReceiverNumber", NC_SHORT, RANK_ReceiverNumber, ReceiverNumber_dims, &ReceiverNumber_id); check_err(stat,__LINE__,__FILE__); NyquistVelocity_dims[0] = mode_dim; stat = nc_def_var(ncid, "NyquistVelocity", NC_FLOAT, RANK_NyquistVelocity, NyquistVelocity_dims, &NyquistVelocity_id); check_err(stat,__LINE__,__FILE__); DCFilterONOFF_dims[0] = mode_dim; stat = nc_def_var(ncid, "DCFilterONOFF", NC_SHORT, RANK_DCFilterONOFF, DCFilterONOFF_dims, &DCFilterONOFF_id); check_err(stat,__LINE__,__FILE__); WindowingONOFF_dims[0] = mode_dim; stat = nc_def_var(ncid, "WindowingONOFF", NC_SHORT, RANK_WindowingONOFF, WindowingONOFF_dims, &WindowingONOFF_id); check_err(stat,__LINE__,__FILE__); ClutterHeight_dims[0] = mode_dim; stat = nc_def_var(ncid, "ClutterHeight", NC_FLOAT, RANK_ClutterHeight, ClutterHeight_dims, &ClutterHeight_id); check_err(stat,__LINE__,__FILE__); Heights_dims[0] = mode_dim; Heights_dims[1] = heights_dim; stat = nc_def_var(ncid, "Heights", NC_FLOAT, RANK_Heights, Heights_dims, &Heights_id); check_err(stat,__LINE__,__FILE__); ModeNum_dims[0] = time_dim; stat = nc_def_var(ncid, "ModeNum", NC_SHORT, RANK_ModeNum, ModeNum_dims, &ModeNum_id); check_err(stat,__LINE__,__FILE__); lat_dims[0] = time_dim; stat = nc_def_var(ncid, "lat", NC_FLOAT, RANK_lat, lat_dims, &lat_id); check_err(stat,__LINE__,__FILE__); lon_dims[0] = time_dim; stat = nc_def_var(ncid, "lon", NC_FLOAT, RANK_lon, lon_dims, &lon_id); check_err(stat,__LINE__,__FILE__); alt_dims[0] = time_dim; stat = nc_def_var(ncid, "alt", NC_SHORT, RANK_alt, alt_dims, &alt_id); check_err(stat,__LINE__,__FILE__); Azimuth_dims[0] = time_dim; stat = nc_def_var(ncid, "Azimuth", NC_SHORT, RANK_Azimuth, Azimuth_dims, &Azimuth_id); check_err(stat,__LINE__,__FILE__); Elevation_dims[0] = time_dim; stat = nc_def_var(ncid, "Elevation", NC_FLOAT, RANK_Elevation, Elevation_dims, &Elevation_id); check_err(stat,__LINE__,__FILE__); DataQualityStatus_dims[0] = time_dim; stat = nc_def_var(ncid, "DataQualityStatus", NC_INT, RANK_DataQualityStatus, DataQualityStatus_dims, &DataQualityStatus_id); check_err(stat,__LINE__,__FILE__); MeanDopplerVelocity_dims[0] = time_dim; MeanDopplerVelocity_dims[1] = heights_dim; stat = nc_def_var(ncid, "MeanDopplerVelocity", NC_FLOAT, RANK_MeanDopplerVelocity, MeanDopplerVelocity_dims, &MeanDopplerVelocity_id); check_err(stat,__LINE__,__FILE__); SignalToNoiseRatio_dims[0] = time_dim; SignalToNoiseRatio_dims[1] = heights_dim; stat = nc_def_var(ncid, "SignalToNoiseRatio", NC_FLOAT, RANK_SignalToNoiseRatio, SignalToNoiseRatio_dims, &SignalToNoiseRatio_id); check_err(stat,__LINE__,__FILE__); Power_dims[0] = time_dim; Power_dims[1] = heights_dim; stat = nc_def_var(ncid, "Power", NC_FLOAT, RANK_Power, Power_dims, &Power_id); check_err(stat,__LINE__,__FILE__); SpectralWidth_dims[0] = time_dim; SpectralWidth_dims[1] = heights_dim; stat = nc_def_var(ncid, "SpectralWidth", NC_FLOAT, RANK_SpectralWidth, SpectralWidth_dims, &SpectralWidth_id); check_err(stat,__LINE__,__FILE__); NoiseLevel_dims[0] = time_dim; NoiseLevel_dims[1] = heights_dim; stat = nc_def_var(ncid, "NoiseLevel", NC_FLOAT, RANK_NoiseLevel, NoiseLevel_dims, &NoiseLevel_id); check_err(stat,__LINE__,__FILE__); Reflectivity_dims[0] = time_dim; Reflectivity_dims[1] = heights_dim; stat = nc_def_var(ncid, "Reflectivity", NC_FLOAT, RANK_Reflectivity, Reflectivity_dims, &Reflectivity_id); check_err(stat,__LINE__,__FILE__); RangeCorrectedPower_dims[0] = time_dim; RangeCorrectedPower_dims[1] = heights_dim; stat = nc_def_var(ncid, "RangeCorrectedPower", NC_FLOAT, RANK_RangeCorrectedPower, RangeCorrectedPower_dims, &RangeCorrectedPower_id); check_err(stat,__LINE__,__FILE__); CircularDepolarizationRatio_dims[0] = time_dim; CircularDepolarizationRatio_dims[1] = heights_dim; stat = nc_def_var(ncid, "CircularDepolarizationRatio", NC_FLOAT, RANK_CircularDepolarizationRatio, CircularDepolarizationRatio_dims, &CircularDepolarizationRatio_id); check_err(stat,__LINE__,__FILE__); AvgNoiseLevel_dims[0] = time_dim; stat = nc_def_var(ncid, "AvgNoiseLevel", NC_FLOAT, RANK_AvgNoiseLevel, AvgNoiseLevel_dims, &AvgNoiseLevel_id); check_err(stat,__LINE__,__FILE__); /* assign attributes */ stat = nc_put_att_text(ncid, base_time_id, "string", 24, "17-Nov-2008,00:00:00 GMT"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, base_time_id, "long_name", 18, "Base Time in Epoch"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, base_time_id, "units", 35, "seconds since 1970-1-1 0:00:00 0:00"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, time_offset_id, "long_name", 26, "Time offset from base_time"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, time_offset_id, "units", 38, "seconds since 2008-11-17 00:00:00 0:00"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ModeDescription_id, "long_name", 26, "radar mode char identifier"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ModeDescription_id, "missing_value", 1, "0"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RxCalTimeStamp_id, "long_name", 23, "Receiver Cal Time Stamp"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RxCalTimeStamp_id, "units", 1, "s"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RxCalTimeStamp_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RxGain_id, "long_name", 13, "Receiver Gain"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RxGain_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RxGain_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SkyNoiseLevel_id, "long_name", 18, "Receiver Sky Noise"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SkyNoiseLevel_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SkyNoiseLevel_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Rx290KLevel_id, "long_name", 19, "Receiver 290K Level"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Rx290KLevel_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Rx290KLevel_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CalCheckLevel_id, "long_name", 24, "Receiver Cal Check Level"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CalCheckLevel_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CalCheckLevel_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CalCheckTime_id, "long_name", 29, "Receiver Cal Check Time Stamp"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CalCheckTime_id, "units", 1, "s"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CalCheckTime_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RadarConstant_id, "long_name", 14, "Radar Constant"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RadarConstant_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RadarConstant_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, MinimumDetectableReflectivity_id, "long_name", 31, "Minimum detectable reflectivity"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, MinimumDetectableReflectivity_id, "units", 3, "dBZ"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, MinimumDetectableReflectivity_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, InterPulsePeriod_id, "long_name", 18, "Inter-Pulse Period"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, InterPulsePeriod_id, "units", 2, "ns"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, InterPulsePeriod_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, PulseWidth_id, "long_name", 11, "Pulse Width"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, PulseWidth_id, "units", 2, "ns"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, PulseWidth_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, StartGateDelay_id, "long_name", 25, "Delay to First Range Gate"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, StartGateDelay_id, "units", 2, "ns"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, StartGateDelay_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, GateSpacing_id, "long_name", 12, "Gate Spacing"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, GateSpacing_id, "units", 2, "ns"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, GateSpacing_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumCoherentIntegrations_id, "long_name", 31, "Number of Coherent Integrations"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumCoherentIntegrations_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumCoherentIntegrations_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumSpectralAverages_id, "long_name", 27, "Number of Spectral Averages"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumSpectralAverages_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumSpectralAverages_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumFFT_id, "long_name", 23, "Number of Points in FFT"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumFFT_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumFFT_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumHeights_id, "long_name", 21, "Number of Range Gates"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumHeights_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumHeights_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumCodeBits_id, "long_name", 19, "Number of Code Bits"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumCodeBits_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumCodeBits_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumReceivers_id, "long_name", 18, "Number of Receiver"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumReceivers_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NumReceivers_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ReceiverMode_id, "long_name", 13, "Receiver Mode"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ReceiverMode_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ReceiverMode_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ReceiverNumber_id, "long_name", 23, "Current Receiver Number"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ReceiverNumber_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ReceiverNumber_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NyquistVelocity_id, "long_name", 16, "Nyquist Velocity"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NyquistVelocity_id, "units", 3, "m/s"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NyquistVelocity_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, DCFilterONOFF_id, "long_name", 26, "DC Filtering ON-OFF Status"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, DCFilterONOFF_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, DCFilterONOFF_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, WindowingONOFF_id, "long_name", 23, "Windowing ON-OFF Status"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, WindowingONOFF_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, WindowingONOFF_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ClutterHeight_id, "long_name", 30, "Max. height of clutter removal"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ClutterHeight_id, "units", 6, "meters"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ClutterHeight_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Heights_id, "long_name", 45, "Range Heights (center of radar sample volume)"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Heights_id, "units", 10, "meters AGL"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Heights_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ModeNum_id, "long_name", 29, "Operating Set for this Record"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ModeNum_id, "units", 5, "count"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, ModeNum_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lat_id, "long_name", 8, "Latitude"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lat_id, "units", 7, "degrees"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lat_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lat_id, "valid_min", 5, "-90.f"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lat_id, "valid_max", 4, "90.f"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lon_id, "long_name", 9, "Longitude"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lon_id, "units", 7, "degrees"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lon_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lon_id, "valid_min", 6, "-180.f"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, lon_id, "valid_max", 5, "180.f"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, alt_id, "long_name", 8, "Altitude"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, alt_id, "units", 27, "meters above Mean Sea Level"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, alt_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Azimuth_id, "long_name", 7, "Azimuth"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Azimuth_id, "units", 7, "degrees"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Azimuth_id, "missing_value", 6, "-32767"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Elevation_id, "long_name", 9, "Elevation"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Elevation_id, "units", 7, "degrees"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Elevation_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, DataQualityStatus_id, "long_name", 19, "Data Quality Status"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, DataQualityStatus_id, "units", 4, "code"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, DataQualityStatus_id, "missing_value", 11, "-2147483647"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, MeanDopplerVelocity_id, "long_name", 21, "Mean Doppler Velocity"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, MeanDopplerVelocity_id, "units", 10, "meters/sec"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, MeanDopplerVelocity_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, MeanDopplerVelocity_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SignalToNoiseRatio_id, "long_name", 21, "Signal to Noise Ratio"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SignalToNoiseRatio_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SignalToNoiseRatio_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SignalToNoiseRatio_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Power_id, "long_name", 20, "Power (uncalibrated)"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Power_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Power_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Power_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SpectralWidth_id, "long_name", 14, "Spectral Width"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SpectralWidth_id, "units", 9, "meter/sec"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SpectralWidth_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, SpectralWidth_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NoiseLevel_id, "long_name", 16, "Mean Noise Level"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NoiseLevel_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NoiseLevel_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NoiseLevel_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Reflectivity_id, "long_name", 12, "Reflectivity"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Reflectivity_id, "units", 3, "dBZ"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Reflectivity_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, Reflectivity_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RangeCorrectedPower_id, "long_name", 32, "Range Corrected Calibrated Power"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RangeCorrectedPower_id, "units", 3, "dBm"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RangeCorrectedPower_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, RangeCorrectedPower_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CircularDepolarizationRatio_id, "long_name", 29, "Circular Depolarization Ratio"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CircularDepolarizationRatio_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CircularDepolarizationRatio_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, CircularDepolarizationRatio_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, AvgNoiseLevel_id, "long_name", 27, "Average Noise Level (S/N<0)"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, AvgNoiseLevel_id, "units", 2, "dB"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, AvgNoiseLevel_id, "resolution", 5, "0.001"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, AvgNoiseLevel_id, "missing_value", 22, "9.9692099683868690e+36"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "site_id", 6, "W-band"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "facility_id", 6, "W-band"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "radar_operating_frequency", 9, "94.56 GHz"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "radar_wavelength", 15, "3.170474e-003 m"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "peak_transmitted_power", 9, "62.24 dBm"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "peak_transmitted_power_timestamp", 13, "-1391624121 s"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "antenna_diameter", 6, "2.10 m"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "twt_status_code", 8, "99000000"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "comment", 32, "DOE/ARM SGP MMCR netcdf raw file"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "resolution_description", 534, "The resolution field attributes refer to the number of significant digits relative to the decimal point that should be used in calculations. Using fewer digits might result in greater uncertainty using a larger number of digits should have no effect and thus is unnecessary. However, analyses based on differences in values with a larger number of significant digits than indicated could lead to erroneous results or misleading scientific conclusions, resolution for lat = 0.001, resolution for lon = 0.001, resolution for alt = 1"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "proc_level", 2, "a1"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "history", 17, "created by LAP-XM"); check_err(stat,__LINE__,__FILE__); stat = nc_put_att_text(ncid, NC_GLOBAL, "comment_on_time", 132, "The time stamp comes at the beginning and end of the sample period. Sample period is made up of data collection and processing time"); check_err(stat,__LINE__,__FILE__); /* leave define mode */ stat = nc_enddef (ncid); check_err(stat,__LINE__,__FILE__); stat = nc_close(ncid); check_err(stat,__LINE__,__FILE__); return 0; }