3333
3434class NdbcCWReader extends NdbcReader {
3535
36- private static final String GST = "GST" ;
37- private static final String MEASUREMENT_TYPE = "measurement_type" ;
38- private static final String ANEMOMETER_HEIGHT = "anemometer_height" ;
39- private static final String SST_DEPTH = "sst_depth" ;
40- private static final String WSPD = "WSPD" ;
4136 private static final String GTIME = "GTIME" ;
4237 private static final String REG_EX_CW = "\\ w{5}c\\ d{4}.txt" ;
43- private static final String STATION_ID = "station_id" ;
44- private static final String STATION_TYPE = "station_type" ;
45- private static final String LONGITUDE = "longitude" ;
46- private static final String LATITUDE = "latitude" ;
47- private static final String BAROMETER_HEIGHT = "barometer_height" ;
48- private static final String WDIR = "WDIR" ;
49- private static final String AIR_TEMP_HEIGHT = "air_temp_height" ;
50- private static final String TIME = "time" ;
38+
5139 private static final String GDR = "GDR" ;
5240
5341 private static StationDatabase stationDatabase ;
@@ -191,12 +179,6 @@ public Array readRaw(int centerX, int centerY, Interval interval, String variabl
191179 return createResultArray (station .getLat (), Float .NaN , DataType .FLOAT , interval );
192180 case ANEMOMETER_HEIGHT :
193181 return createResultArray (station .getAnemometerHeight (), Float .NaN , DataType .FLOAT , interval );
194- case AIR_TEMP_HEIGHT :
195- return createResultArray (station .getAirTemperatureHeight (), Float .NaN , DataType .FLOAT , interval );
196- case BAROMETER_HEIGHT :
197- return createResultArray (station .getBarometerHeight (), Float .NaN , DataType .FLOAT , interval );
198- case SST_DEPTH :
199- return createResultArray (station .getSSTDepth (), Float .NaN , DataType .FLOAT , interval );
200182 case TIME :
201183 return createResultArray (record .utc , NetCDFUtils .getDefaultFillValue (int .class ), DataType .INT , interval );
202184 case WDIR :
@@ -231,74 +213,13 @@ public List<Variable> getVariables() throws InvalidRangeException, IOException {
231213 final ArrayList <Variable > variables = new ArrayList <>();
232214
233215 List <Attribute > attributes = new ArrayList <>();
234- // station variables
235- attributes .add (new Attribute (CF_LONG_NAME , "Station identifier" ));
236- variables .add (new VariableProxy (STATION_ID , DataType .STRING , attributes ));
237-
238- attributes = new ArrayList <>();
239- attributes .add (new Attribute (CF_LONG_NAME , "Station type. 0: OCEAN_BUOY, 1: COAST_BUOY, 2: LAKE_BUOY, 3: OCEAN_STATION, 4: COAST_STATION, 5: LAKE_STATION" ));
240- variables .add (new VariableProxy (STATION_TYPE , DataType .BYTE , attributes ));
241-
242- attributes = new ArrayList <>();
243- attributes .add (new Attribute (CF_LONG_NAME , "Measurement type. 0: CONSTANT_WIND, 1: STANDARD_METEOROLOGICAL" ));
244- variables .add (new VariableProxy (MEASUREMENT_TYPE , DataType .BYTE , attributes ));
245-
246- attributes = new ArrayList <>();
247- attributes .add (new Attribute (CF_UNITS_NAME , "degree_east" ));
248- attributes .add (new Attribute (CF_FILL_VALUE_NAME , NetCDFUtils .getDefaultFillValue (float .class )));
249- attributes .add (new Attribute (CF_STANDARD_NAME , "longitude" ));
250- variables .add (new VariableProxy (LONGITUDE , DataType .FLOAT , attributes ));
251-
252- attributes = new ArrayList <>();
253- attributes .add (new Attribute (CF_UNITS_NAME , "degree_north" ));
254- attributes .add (new Attribute (CF_FILL_VALUE_NAME , NetCDFUtils .getDefaultFillValue (float .class )));
255- attributes .add (new Attribute (CF_STANDARD_NAME , "latitude" ));
256- variables .add (new VariableProxy (LATITUDE , DataType .FLOAT , attributes ));
257-
258- attributes = new ArrayList <>();
259- attributes .add (new Attribute (CF_UNITS_NAME , "m" ));
260- attributes .add (new Attribute (CF_FILL_VALUE_NAME , Float .NaN ));
261- attributes .add (new Attribute (CF_LONG_NAME , "Height of instrument above site elevation" ));
262- variables .add (new VariableProxy (ANEMOMETER_HEIGHT , DataType .FLOAT , attributes ));
263-
264- attributes = new ArrayList <>();
265- attributes .add (new Attribute (CF_UNITS_NAME , "m" ));
266- attributes .add (new Attribute (CF_FILL_VALUE_NAME , Float .NaN ));
267- attributes .add (new Attribute (CF_LONG_NAME , "Height of instrument above site elevation" ));
268- variables .add (new VariableProxy (AIR_TEMP_HEIGHT , DataType .FLOAT , attributes ));
269-
270- attributes = new ArrayList <>();
271- attributes .add (new Attribute (CF_UNITS_NAME , "m" ));
272- attributes .add (new Attribute (CF_FILL_VALUE_NAME , Float .NaN ));
273- attributes .add (new Attribute (CF_LONG_NAME , "Height of instrument above above mean sea level" ));
274- variables .add (new VariableProxy (BAROMETER_HEIGHT , DataType .FLOAT , attributes ));
275-
276- attributes = new ArrayList <>();
277- attributes .add (new Attribute (CF_UNITS_NAME , "m" ));
278- attributes .add (new Attribute (CF_FILL_VALUE_NAME , Float .NaN ));
279- attributes .add (new Attribute (CF_LONG_NAME , "Depth of instrument below water line" ));
280- variables .add (new VariableProxy (SST_DEPTH , DataType .FLOAT , attributes ));
281-
282- attributes = new ArrayList <>();
283- attributes .add (new Attribute (CF_UNITS_NAME , "seconds since 1970-01-01" ));
284- attributes .add (new Attribute (CF_FILL_VALUE_NAME , NetCDFUtils .getDefaultFillValue (int .class )));
285- attributes .add (new Attribute (CF_STANDARD_NAME , "time" ));
286- variables .add (new VariableProxy (TIME , DataType .INT , attributes ));
287216
288- // measurement record variables
289- attributes = new ArrayList <>();
290- attributes .add (new Attribute (CF_UNITS_NAME , "degT" ));
291- attributes .add (new Attribute (CF_FILL_VALUE_NAME , 999 ));
292- attributes .add (new Attribute (CF_STANDARD_NAME , "wind_from_direction" ));
293- attributes .add (new Attribute (CF_LONG_NAME , "Ten-minute average wind direction measurements in degrees clockwise from true North." ));
294- variables .add (new VariableProxy (WDIR , DataType .SHORT , attributes ));
217+ createBasicStationVariables (variables , attributes );
295218
296- attributes = new ArrayList <>();
297- attributes .add (new Attribute (CF_UNITS_NAME , "m/s" ));
298- attributes .add (new Attribute (CF_FILL_VALUE_NAME , 99.f ));
299- attributes .add (new Attribute (CF_STANDARD_NAME , "wind_speed" ));
300- attributes .add (new Attribute (CF_LONG_NAME , "Ten-minute average wind speed values in m/s." ));
301- variables .add (new VariableProxy (WSPD , DataType .FLOAT , attributes ));
219+ // measurement record variables ----------------------------------
220+ createMeasurementTimeVariable (variables );
221+ createWindDirectionVariable (variables );
222+ createWindSpeedVariable (variables );
302223
303224 attributes = new ArrayList <>();
304225 attributes .add (new Attribute (CF_UNITS_NAME , "degT" ));
@@ -307,12 +228,7 @@ public List<Variable> getVariables() throws InvalidRangeException, IOException {
307228 attributes .add (new Attribute (CF_LONG_NAME , "Direction, in degrees clockwise from true North, of the GST, reported at the last hourly 10-minute segment." ));
308229 variables .add (new VariableProxy (GDR , DataType .SHORT , attributes ));
309230
310- attributes = new ArrayList <>();
311- attributes .add (new Attribute (CF_UNITS_NAME , "m/s" ));
312- attributes .add (new Attribute (CF_FILL_VALUE_NAME , 99.f ));
313- attributes .add (new Attribute (CF_STANDARD_NAME , "wind_gust_speed" ));
314- attributes .add (new Attribute (CF_LONG_NAME , "Maximum 5-second peak gust during the measurement hour, reported at the last hourly 10-minute segment." ));
315- variables .add (new VariableProxy (GST , DataType .FLOAT , attributes ));
231+ createGustSpeedVariable (variables , "Maximum 5-second peak gust during the measurement hour, reported at the last hourly 10-minute segment." );
316232
317233 attributes = new ArrayList <>();
318234 attributes .add (new Attribute (CF_UNITS_NAME , "hhmm" ));
0 commit comments