% netcdf_create -- create global attributes, dimensions, coordinate % and data variables %% GLOBALS % static info from nc_this or hard coded here nc.title = ['METAR Data for (' info.platform_name ') ' info.location_name]; nc.institution = 'National Weather Service (NWS)'; nc.institution_url = 'http://weather.noaa.gov'; nc.institution_dods_url = 'http://nccoos.unc.edu'; nc.institution_code = 'nws'; nc.metadata_url = 'TDB'; nc.references = 'http://metar.noaa.gov/'; nc.contact = 'http://metar.noaa.gov/'; nc.source = 'surface observation'; nc.history = 'processed data from NWS from AWOS/ASOS stations'; nc.comment = 'METAR obs parsed using MATLAB. Not all fields parsed.'; % conventions nc.Conventions = 'CF-1.0'; nc.format = 'SEA-COOS RT'; nc.seacoos_rt_version = '2.0'; nc.format_category_code = 'fixed-point'; % platform info nc.platform_code = info.platform_name; nc.location_name = info.location_name; % package info % nc.data_type = 'surface meteorlogical'; nc.data_type = 'met'; nc.instrument_code = 'AWOS/ASOS'; nc.package_code = info.package_name; % timeframe of data nc.start_date = [datestr(dn(1), 'yyyy-mm-dd HH:MM:SS') ' UTC']; nc.end_date = [datestr(dn(end), 'yyyy-mm-dd HH:MM:SS') ' UTC']; nc.release_date = [datestr(info.current_time_dn, 'yyyy-mm-dd HH:MM:SS') ' UTC']; nc.creation_date = [datestr(info.current_time_dn, 'yyyy-mm-dd HH:MM:SS') ' UTC']; nc.modification_date = [datestr(info.current_time_dn, 'yyyy-mm-dd HH:MM:SS') ' UTC']; nc.process_level = 'raw data'; nc.FillValue_ = ncdouble(-9999); % %% DIMENSIONS nc('time') = length(dn); nc('lat') = 1; nc('lon') = 1; nc('z') = 1; nc('ndate') = 19; %% VARIABLES (coordinate) nc{'time'} = ncdouble('time'); nc{'time'}.short_name = 'time'; nc{'time'}.long_name = 'Time'; nc{'time'}.standard_name = 'time'; nc{'time'}.units = 'seconds since 1970-1-1 00:00:00 -0'; nc{'time'}.axis = 'T'; nc{'source_time'} = ncdouble('time'); nc{'source_time'}.short_name = 'source_time'; nc{'source_time'}.long_name = 'Data Provider Time'; nc{'source_time'}.units = 'days since 0000-1-1 00:00:00 -0'; nc{'source_time'}.calendar = 'none'; nc{'date_time_string'} = ncchar('time', 'ndate'); nc{'date_time_string'}.units = 'string YYYY-MM-DD hh:mm:ss'; nc{'date_time_string'}.c_format = '%4d-%2d-%2d %2d:%2d:%2d'; nc{'lat'} = ncdouble('lat'); nc{'lat'}.long_name = 'Latitude'; nc{'lat'}.short_name = 'latitude'; nc{'lat'}.standard_name = 'latitude'; nc{'lat'}.reference = 'geographic coordinates'; nc{'lat'}.units = 'degrees_north'; nc{'lat'}.valid_range = [-90 90]; nc{'lat'}.axis = 'Y'; nc{'lon'} = ncdouble('lon'); nc{'lon'}.long_name = 'Longitude'; nc{'lon'}.short_name = 'longitude'; nc{'lon'}.standard_name = 'longitude'; nc{'lon'}.units = 'degrees_east'; nc{'lon'}.valid_range = ncdouble([-180 180]); nc{'lon'}.axis = 'X'; nc{'z'} = ncdouble('z'); nc{'z'}.long_name = 'Height'; nc{'z'}.short_name = 'height'; nc{'z'}.standard_name = 'height'; nc{'z'}.units = 'm'; nc{'z'}.reference = 'zero is sea-level'; nc{'z'}.positive = 'up'; nc{'z'}.axis = 'Z'; nc{'time'}(:) = seacoos_time_1970; nc{'source_time'}(:) = dn; nc{'date_time_string'}(:) = date_time_string; nc{'lat'}(:) = info.location_lat; nc{'lon'}(:) = info.location_lon; nc{'z'}(:) = info.location_elev; %% VARIABLES (data) nc{'wspd'} = ncdouble('time'); nc{'wspd'}.long_name = 'Wind Speed'; nc{'wspd'}.standard_name = 'wind_speed'; nc{'wspd'}.units = 'm s-1'; nc{'wspd'}.can_be_normalized = 'no'; nc{'wspd'}(:) = wspd; nc{'wdir'} = ncdouble('time'); nc{'wdir'}.long_name = 'Wind Direction (from)'; nc{'wdir'}.standard_name = 'wind_from_direction'; nc{'wdir'}.units = 'degrees'; nc{'wdir'}.reference = 'clockwise from true north'; nc{'wdir'}.valid_range = [0 360]; nc{'wdir'}.can_be_normalized = 'no'; nc{'wdir'}(:) = wdir; nc{'eastward_wind'} = ncdouble('time'); nc{'eastward_wind'}.long_name = 'East/West Component of Wind'; nc{'eastward_wind'}.standard_name = 'eastward_wind'; nc{'eastward_wind'}.units = 'm s-1'; nc{'eastward_wind'}.can_be_normalized = 'no'; nc{'eastward_wind'}(:) = WVE; nc{'northward_wind'} = ncdouble('time'); nc{'northward_wind'}.long_name = 'North/South Component of Wind'; nc{'northward_wind'}.standard_name = 'northward_wind'; nc{'northward_wind'}.units = 'm s-1'; nc{'northward_wind'}.can_be_normalized = 'no'; nc{'northward_wind'}(:) = WVN; nc{'wind_gust'} = ncdouble('time'); nc{'wind_gust'}.long_name = 'Wind Gust'; nc{'wind_gust'}.standard_name = 'wind_gust'; nc{'wind_gust'}.units = 'm s-1'; nc{'wind_gust'}.can_be_normalized = 'no'; nc{'wind_gust'}(:) = maxwspd; nc{'air_temp'} = ncdouble('time'); nc{'air_temp'}.long_name = 'Air Temperature'; nc{'air_temp'}.standard_name = 'air_temperature'; nc{'air_temp'}.units = 'degrees Celsius'; nc{'air_temp'}(:) = atemp; nc{'dew_temp'} = ncdouble('time'); nc{'dew_temp'}.long_name = 'Dew Temperature'; nc{'dew_temp'}.standard_name = 'dew_temperature'; nc{'dew_temp'}.units = 'degrees Celsius'; nc{'dew_temp'}(:) = dewp; nc{'air_pressure'} = ncdouble('time'); nc{'air_pressure'}.long_name = 'Air Pressure at Barometer Height'; nc{'air_pressure'}.standard_name = 'air_pressure'; nc{'air_pressure'}.units = 'hPa'; nc{'air_pressure'}(:) = baro; % NOT writing sealevel pressure to netcdf file since numbers seem screwed up. % % slp calculated is really high, and slp from metar obs is lower than altimeter % reading converted to mbar. % nc{'air_pressure_at_sealevel'} = ncdouble('z2','time'); % nc{'air_pressure_at_sealevel'}.long_name = 'Air Pressure at Sealevel'; % nc{'air_pressure_at_sealevel'}.standard_name = 'air_pressure_at_sealevel'; % nc{'air_pressure_at_sealevel'}.units = 'hPa'; % nc{'air_pressure_at_sealevel'}.z = 0; % nc{'air_pressure_at_sealevel'}.z_units = 'm'; % nc{'air_pressure_at_sealevel'}(:) = slp; %