| 1 |
package nom.tam.fits.header; |
| 2 |
|
| 3 |
import java.util.Arrays; |
| 4 |
|
| 5 |
import nom.tam.fits.header.extra.CommonExt; |
| 6 |
import nom.tam.fits.header.extra.MaxImDLExt; |
| 7 |
import nom.tam.fits.header.extra.NOAOExt; |
| 8 |
import nom.tam.fits.header.extra.SBFitsExt; |
| 9 |
import nom.tam.fits.header.extra.STScIExt; |
| 10 |
|
| 11 |
/* |
| 12 |
* #%L |
| 13 |
* nom.tam FITS library |
| 14 |
* %% |
| 15 |
* Copyright (C) 1996 - 2024 nom-tam-fits |
| 16 |
* %% |
| 17 |
* This is free and unencumbered software released into the public domain. |
| 18 |
* |
| 19 |
* Anyone is free to copy, modify, publish, use, compile, sell, or |
| 20 |
* distribute this software, either in source code form or as a compiled |
| 21 |
* binary, for any purpose, commercial or non-commercial, and by any |
| 22 |
* means. |
| 23 |
* |
| 24 |
* In jurisdictions that recognize copyright laws, the author or authors |
| 25 |
* of this software dedicate any and all copyright interest in the |
| 26 |
* software to the public domain. We make this dedication for the benefit |
| 27 |
* of the public at large and to the detriment of our heirs and |
| 28 |
* successors. We intend this dedication to be an overt act of |
| 29 |
* relinquishment in perpetuity of all present and future rights to this |
| 30 |
* software under copyright law. |
| 31 |
* |
| 32 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 33 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 34 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 35 |
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 36 |
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 37 |
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 38 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 39 |
* #L% |
| 40 |
*/ |
| 41 |
|
| 42 |
/** |
| 43 |
* This enum wil try to list synonyms inside or over different dictionaries. So please use always the highest level |
| 44 |
* keyword you can find. |
| 45 |
* |
| 46 |
* @author Richard van Nieuwenhoven, Attila Kovacs, and John Murphy |
| 47 |
*/ |
| 48 |
@SuppressWarnings("deprecation") |
| 49 |
public enum Synonyms { |
| 50 |
|
| 51 |
/** EQUINOX is now preferred over the old EPOCH */ |
| 52 |
EQUINOX(Standard.EQUINOX, Standard.EPOCH), |
| 53 |
|
| 54 |
/** RADESYS is now preferred over the old RADECSYS */ |
| 55 |
RADESYS(Standard.RADESYS, Standard.RADECSYS), |
| 56 |
|
| 57 |
/** RESTFRQ is now preferred over the old RESTFREQ */ |
| 58 |
RESTFRQ(Standard.RESTFRQ, WCS.RESTFREQ), |
| 59 |
|
| 60 |
/** |
| 61 |
* Equivalent keywords for column coordinate transformation matrix (PC convention). The shorter form may be required |
| 62 |
* for column indices >99 with alternate coordinate systems. |
| 63 |
* |
| 64 |
* @since 1.19 |
| 65 |
*/ |
| 66 |
TPn_na(WCS.TPn_na, WCS.TPCn_na), |
| 67 |
|
| 68 |
/** |
| 69 |
* Equivalent keywords for column coordinate transformation matrix (CD convention). The shorter form may be required |
| 70 |
* for column indices >99 with alternate coordinate systems. |
| 71 |
* |
| 72 |
* @since 1.19 |
| 73 |
*/ |
| 74 |
TCn_na(WCS.TCn_na, WCS.TCDn_na), |
| 75 |
|
| 76 |
/** |
| 77 |
* Equivalent keywords for column parameter names. The shorter form may be required for column indices >99 with |
| 78 |
* alternate coordinate systems. |
| 79 |
* |
| 80 |
* @since 1.19 |
| 81 |
*/ |
| 82 |
TSn_na(WCS.TVn_na, WCS.TPSn_na), |
| 83 |
|
| 84 |
/** |
| 85 |
* Equivalent keywords for column parameter values. The shorter form may be required for column indices >99 with |
| 86 |
* alternate coordinate systems. |
| 87 |
* |
| 88 |
* @since 1.19 |
| 89 |
*/ |
| 90 |
TVn_na(WCS.TVn_na, WCS.TPVn_na), |
| 91 |
|
| 92 |
/** |
| 93 |
* Equivalent keywords for column coordinate transformation matrix (PC convention). The shorter form may be required |
| 94 |
* for column indices >99 with alternate coordinate systems. |
| 95 |
* |
| 96 |
* @since 1.19 |
| 97 |
*/ |
| 98 |
WCSna(WCS.WCSna, WCS.TWCSna), |
| 99 |
|
| 100 |
/** |
| 101 |
* Equivalent keywords for array column axis string parameters. The shorter form may be required for column indices |
| 102 |
* >99 with alternate coordinate systems. |
| 103 |
* |
| 104 |
* @since 1.19 |
| 105 |
*/ |
| 106 |
nSn_na(WCS.nSn_na, WCS.nPSn_na), |
| 107 |
|
| 108 |
/** |
| 109 |
* Equivalent keywords for array column axis parameter values. The shorter form may be required for column indices |
| 110 |
* >99 with alternate coordinate systems. |
| 111 |
* |
| 112 |
* @since 1.19 |
| 113 |
*/ |
| 114 |
nVn_na(WCS.nVn_na, WCS.nPVn_na), |
| 115 |
|
| 116 |
/** |
| 117 |
* EXTNAME and HDUNAME are synonymous, but EXTNAME is part of the standard since 1.19 |
| 118 |
*/ |
| 119 |
EXTNAME(Standard.EXTNAME, DataDescription.HDUNAME), |
| 120 |
|
| 121 |
/** |
| 122 |
* EXTVER and HDUVER are synonymous, but EXTVER is part of the standard since 1.19 |
| 123 |
*/ |
| 124 |
EXTVER(Standard.EXTVER, DataDescription.HDUVER), |
| 125 |
|
| 126 |
/** |
| 127 |
* EXTLEVEL and HDULEVEL are synonymous, but EXTLEVEL is part of the standard since 1.19 |
| 128 |
*/ |
| 129 |
EXTLEVEL(Standard.EXTLEVEL, DataDescription.HDULEVEL), |
| 130 |
|
| 131 |
/** |
| 132 |
* [s] Non-standard exposure time conventions. |
| 133 |
* |
| 134 |
* @see DateTime#XPOSURE |
| 135 |
*/ |
| 136 |
EXPOSURE(ObservationDurationDescription.EXPOSURE, ObservationDurationDescription.EXPTIME, |
| 137 |
ObservationDurationDescription.ONTIME, STScIExt.XPOSURE), |
| 138 |
|
| 139 |
/** |
| 140 |
* Variants for recording the start time of observation in HH:MM:SS[.s...] format |
| 141 |
*/ |
| 142 |
TSTART(DateTime.TSTART, ObservationDurationDescription.TIME_OBS), |
| 143 |
|
| 144 |
/** |
| 145 |
* Variants for recording the ending time of observation in HH:MM:SS[.s...] format |
| 146 |
*/ |
| 147 |
TSTOP(DateTime.TSTOP, ObservationDurationDescription.TIME_END), |
| 148 |
|
| 149 |
/** DARKTIME appears in multiple conventions */ |
| 150 |
DARKTIME(NOAOExt.DARKTIME, SBFitsExt.DARKTIME), |
| 151 |
|
| 152 |
/** |
| 153 |
* Image rotation angle in degrees |
| 154 |
* |
| 155 |
* @since 1.20.1 |
| 156 |
*/ |
| 157 |
OBJCTROT(CommonExt.OBJCTROT, CommonExt.ANGLE), |
| 158 |
|
| 159 |
/** |
| 160 |
* Electronic gain -- electrons per ADU |
| 161 |
* |
| 162 |
* @since 1.20.1 |
| 163 |
*/ |
| 164 |
EGAIN(SBFitsExt.EGAIN, CommonExt.GAINADU), |
| 165 |
|
| 166 |
/** |
| 167 |
* Focuser name |
| 168 |
* |
| 169 |
* @since 1.20.1 |
| 170 |
*/ |
| 171 |
FOCUSER(CommonExt.FOCUSER, CommonExt.FOCNAME), |
| 172 |
|
| 173 |
/** |
| 174 |
* Focus position steps |
| 175 |
* |
| 176 |
* @since 1.20.1 |
| 177 |
*/ |
| 178 |
FOCUSPOS(MaxImDLExt.FOCUSPOS, CommonExt.FOCPOS), |
| 179 |
|
| 180 |
/** |
| 181 |
* Focus temperature in degrees Celsius. |
| 182 |
* |
| 183 |
* @since 1.20.1 |
| 184 |
*/ |
| 185 |
FOCUSTEM(MaxImDLExt.FOCUSTEM, CommonExt.FOCTEMP), |
| 186 |
|
| 187 |
/** |
| 188 |
* Camera gain / ISO speed |
| 189 |
* |
| 190 |
* @since 1.20.1 |
| 191 |
*/ |
| 192 |
ISOSPEED(MaxImDLExt.ISOSPEED, CommonExt.GAINRAW), |
| 193 |
|
| 194 |
/** |
| 195 |
* Pixel binning in X direction |
| 196 |
* |
| 197 |
* @since 1.20.1 |
| 198 |
*/ |
| 199 |
XBINNING(SBFitsExt.XBINNING, CommonExt.CCDXBIN), |
| 200 |
|
| 201 |
/** |
| 202 |
* Pixel binning in Y direction |
| 203 |
* |
| 204 |
* @since 1.20.1 |
| 205 |
*/ |
| 206 |
YBINNING(SBFitsExt.YBINNING, CommonExt.CCDYBIN), |
| 207 |
|
| 208 |
/** |
| 209 |
* Image scale (arcsec/pixel) |
| 210 |
* |
| 211 |
* @since 1.20.1 |
| 212 |
*/ |
| 213 |
PIXSCALE(CommonExt.PIXSCALE, CommonExt.SCALE), |
| 214 |
|
| 215 |
/** |
| 216 |
* Cloud cover percentage |
| 217 |
* |
| 218 |
* @since 1.20.1 |
| 219 |
*/ |
| 220 |
CLOUDCVR(CommonExt.CLOUDCVR, MaxImDLExt.AOCCLOUD), |
| 221 |
|
| 222 |
/** |
| 223 |
* Relative humidity in percent |
| 224 |
* |
| 225 |
* @since 1.20.1 |
| 226 |
*/ |
| 227 |
HUMIDITY(CommonExt.HUMIDITY, MaxImDLExt.AOCHUM, MaxImDLExt.BOLTHUM, MaxImDLExt.DAVHUM), |
| 228 |
|
| 229 |
/** |
| 230 |
* Dew point in degrees Celsius |
| 231 |
* |
| 232 |
* @since 1.20.1 |
| 233 |
*/ |
| 234 |
DEWPOINT(CommonExt.DEWPOINT, MaxImDLExt.AOCDEW, MaxImDLExt.BOLTDEW, MaxImDLExt.DAVDEW), |
| 235 |
|
| 236 |
/** |
| 237 |
* Ambient temperature in degrees Celsius |
| 238 |
* |
| 239 |
* @since 1.20.1 |
| 240 |
*/ |
| 241 |
AMBTEMP(CommonExt.AMBTEMP, MaxImDLExt.AOCAMBT, MaxImDLExt.BOLTAMBT, MaxImDLExt.DAVAMBT), |
| 242 |
|
| 243 |
/** |
| 244 |
* Wind speed in km/h |
| 245 |
* |
| 246 |
* @since 1.20.1 |
| 247 |
*/ |
| 248 |
WINDSPD(CommonExt.WINDSPD, MaxImDLExt.BOLTWIND, MaxImDLExt.DAVWIND), // MaxImDLExt.AOCWIND, uses different units |
| 249 |
|
| 250 |
/** |
| 251 |
* Wind direction in degrees, clockwise from North |
| 252 |
* |
| 253 |
* @since 1.20.1 |
| 254 |
*/ |
| 255 |
WINDDIR(CommonExt.WINDDIR, MaxImDLExt.AOCWINDD, MaxImDLExt.DAVWINDD), |
| 256 |
|
| 257 |
/** |
| 258 |
* Atmospheric pressure in hPA |
| 259 |
* |
| 260 |
* @since 1.20.1 |
| 261 |
*/ |
| 262 |
PRESSURE(CommonExt.PRESSURE, MaxImDLExt.AOCBAROM, MaxImDLExt.DAVBAROM), |
| 263 |
|
| 264 |
/** |
| 265 |
* Software that created the original FITS file. |
| 266 |
* |
| 267 |
* @since 1.20.1 |
| 268 |
*/ |
| 269 |
CREATOR(DataDescription.CREATOR, DataDescription.PROGRAM, SBFitsExt.SWCREATE), |
| 270 |
|
| 271 |
/** |
| 272 |
* Clock time duration of observation. |
| 273 |
* |
| 274 |
* @since 1.20.1 |
| 275 |
*/ |
| 276 |
TELAPSE(DateTime.TELAPSE, ObservationDurationDescription.ELAPTIME); |
| 277 |
|
| 278 |
private final IFitsHeader primaryKeyword; |
| 279 |
|
| 280 |
private final IFitsHeader[] synonyms; |
| 281 |
|
| 282 |
Synonyms(IFitsHeader primaryKeyword, IFitsHeader... synonyms) { |
| 283 |
this.primaryKeyword = primaryKeyword; |
| 284 |
this.synonyms = synonyms; |
| 285 |
} |
| 286 |
|
| 287 |
/** |
| 288 |
* Returns the list of equivalent FITS header keywords as an array |
| 289 |
* |
| 290 |
* @return an array containing the list of equivalent (interchangeable) FITS header keywords |
| 291 |
*/ |
| 292 |
public IFitsHeader[] getSynonyms() { |
| 293 |
return Arrays.copyOf(synonyms, synonyms.length); |
| 294 |
} |
| 295 |
|
| 296 |
/** |
| 297 |
* Returns the primary or preferred FITS header keyword to use to provide this information in a FITS header. |
| 298 |
* |
| 299 |
* @return the primary (or preferred) FITS header keyword form to use |
| 300 |
*/ |
| 301 |
public IFitsHeader primaryKeyword() { |
| 302 |
return primaryKeyword; |
| 303 |
} |
| 304 |
|
| 305 |
/** |
| 306 |
* Returns the primary or preferred FITS header keyword to prefer for the given header entry to provide this |
| 307 |
* information in a FITS header. |
| 308 |
* |
| 309 |
* @param key the standard or conventional header keyword. |
| 310 |
* |
| 311 |
* @return the primary (or preferred) FITS header keyword form to use |
| 312 |
* |
| 313 |
* @see #primaryKeyword(String) |
| 314 |
* @see #primaryKeyword() |
| 315 |
*/ |
| 316 |
public static IFitsHeader primaryKeyword(IFitsHeader key) { |
| 317 |
for (Synonyms synonym : values()) { |
| 318 |
for (IFitsHeader synHeader : synonym.synonyms) { |
| 319 |
if (synHeader.equals(key)) { |
| 320 |
return synonym.primaryKeyword(); |
| 321 |
} |
| 322 |
} |
| 323 |
} |
| 324 |
return key; |
| 325 |
} |
| 326 |
|
| 327 |
/** |
| 328 |
* Returns the primary or preferred FITS header keyword to prefer for the given header entry to provide this |
| 329 |
* information in a FITS header. |
| 330 |
* |
| 331 |
* @param header the string FITS header keyword |
| 332 |
* |
| 333 |
* @return the primary (or preferred) FITS header keyword form to use |
| 334 |
* |
| 335 |
* @see #primaryKeyword(IFitsHeader) |
| 336 |
*/ |
| 337 |
public static String primaryKeyword(String header) { |
| 338 |
for (Synonyms synonym : values()) { |
| 339 |
for (IFitsHeader synHeader : synonym.synonyms) { |
| 340 |
if (synHeader.key().equals(header)) { |
| 341 |
return synonym.primaryKeyword().key(); |
| 342 |
} |
| 343 |
} |
| 344 |
} |
| 345 |
return header; |
| 346 |
} |
| 347 |
} |