1 | /** |
---|
2 | * $Id: SGTMetaData.java,v 1.3 2001/02/06 00:47:25 dwd Exp $ |
---|
3 | * |
---|
4 | * This software is provided by NOAA for full, free and open release. It is |
---|
5 | * understood by the recipient/user that NOAA assumes no liability for any |
---|
6 | * errors contained in the code. Although this software is released without |
---|
7 | * conditions or restrictions in its use, it is expected that appropriate |
---|
8 | * credit be given to its author and to the National Oceanic and Atmospheric |
---|
9 | * Administration should the software be included by the recipient as an |
---|
10 | * element in other product development. |
---|
11 | */ |
---|
12 | |
---|
13 | package gov.noaa.pmel.sgt.dm; |
---|
14 | |
---|
15 | import gov.noaa.pmel.util.GeoDate; |
---|
16 | import java.util.Properties; |
---|
17 | /** |
---|
18 | * MetaData container for the sgt datamodel. |
---|
19 | * |
---|
20 | * @author Donald Denbo |
---|
21 | * @version $Revision: 1.3 $, $Date: 2001/02/06 00:47:25 $ |
---|
22 | * @since 1.0 |
---|
23 | */ |
---|
24 | public class SGTMetaData implements java.io.Serializable { |
---|
25 | private String name_; |
---|
26 | private String units_; |
---|
27 | private boolean modulo_; |
---|
28 | private double moduloValue_ = 0.0; |
---|
29 | private GeoDate moduloTime_ = null; |
---|
30 | private boolean reversed_; |
---|
31 | private Properties props_ = null; |
---|
32 | /** |
---|
33 | * Default constructor. |
---|
34 | */ |
---|
35 | public SGTMetaData() { |
---|
36 | this("", ""); |
---|
37 | } |
---|
38 | /** |
---|
39 | * SGTMetaData constructor. |
---|
40 | * |
---|
41 | * @param name variable name |
---|
42 | * @param units units of variable |
---|
43 | */ |
---|
44 | public SGTMetaData(String name,String units) { |
---|
45 | this(name, units, false, false); |
---|
46 | } |
---|
47 | public SGTMetaData(String name, String units, boolean rev, boolean mod) { |
---|
48 | name_ = name; |
---|
49 | units_ = units; |
---|
50 | reversed_ = rev; |
---|
51 | modulo_ = mod; |
---|
52 | } |
---|
53 | /** |
---|
54 | * Get the name associated with the variable or coordinate. |
---|
55 | */ |
---|
56 | public String getName() { |
---|
57 | return name_; |
---|
58 | } |
---|
59 | /** |
---|
60 | * Axis values are reversed. This axis defines a left-hand |
---|
61 | * coordinate system. For example, northward, eastward, downward, |
---|
62 | * is left-handed. |
---|
63 | */ |
---|
64 | public boolean isReversed() { |
---|
65 | return reversed_; |
---|
66 | } |
---|
67 | /** |
---|
68 | * Axis values are modulo. For example, 0 and 360 longitude are |
---|
69 | * equivalent values. |
---|
70 | */ |
---|
71 | public boolean isModulo() { |
---|
72 | return modulo_; |
---|
73 | } |
---|
74 | /** |
---|
75 | * Set the modulo value. For example, 360 for longitude. |
---|
76 | */ |
---|
77 | public void setModuloValue(double val) { |
---|
78 | moduloValue_ = val; |
---|
79 | } |
---|
80 | /** |
---|
81 | * Set temporal modulo value. For example, 365 days, for yearly |
---|
82 | * climatologies. |
---|
83 | */ |
---|
84 | public void setModuloTime(GeoDate val) { |
---|
85 | moduloTime_ = val; |
---|
86 | } |
---|
87 | /** |
---|
88 | * Get modulo value. |
---|
89 | */ |
---|
90 | public double getModuloValue() { |
---|
91 | return moduloValue_; |
---|
92 | } |
---|
93 | /** |
---|
94 | * Get temporal modulo value |
---|
95 | */ |
---|
96 | public GeoDate getModuloTime() { |
---|
97 | return moduloTime_; |
---|
98 | } |
---|
99 | /** |
---|
100 | * Set name of coordinate or variable |
---|
101 | */ |
---|
102 | public void setName(String name) { |
---|
103 | name_ = name; |
---|
104 | } |
---|
105 | /** |
---|
106 | * Set units of coordinate or variable |
---|
107 | */ |
---|
108 | public void setUnits(String units) { |
---|
109 | units_ = units; |
---|
110 | } |
---|
111 | /** |
---|
112 | * Set additional properties for the coordinate or variable. |
---|
113 | */ |
---|
114 | public void setProperties(Properties props) { |
---|
115 | props_ = props; |
---|
116 | } |
---|
117 | /** |
---|
118 | * Get variable or coordinate additional properties. |
---|
119 | */ |
---|
120 | public Properties getProperties() { |
---|
121 | return props_; |
---|
122 | } |
---|
123 | /** |
---|
124 | * Get property value given the key. |
---|
125 | */ |
---|
126 | public String getProperty(String key) { |
---|
127 | return getProperty(key, ""); |
---|
128 | } |
---|
129 | /** |
---|
130 | * Get property value given the key, if key is not defined use the |
---|
131 | * default value. |
---|
132 | */ |
---|
133 | public String getProperty(String key,String defValue) { |
---|
134 | if(props_ != null) { |
---|
135 | return props_.getProperty(key, defValue); |
---|
136 | } else { |
---|
137 | return null; |
---|
138 | } |
---|
139 | } |
---|
140 | /** |
---|
141 | * Set a property for the variable or coordinate. |
---|
142 | */ |
---|
143 | public void setProperty(String key,String value) { |
---|
144 | if(props_ == null) { |
---|
145 | props_ = new Properties(); |
---|
146 | } |
---|
147 | props_.put(key, value); |
---|
148 | } |
---|
149 | /** |
---|
150 | * Get variable or coordinate units. |
---|
151 | */ |
---|
152 | public String getUnits() { |
---|
153 | return units_; |
---|
154 | } |
---|
155 | } |
---|