Changeset 19007 for trunk/psModules/src/camera/pmFPAfile.c
- Timestamp:
- Aug 11, 2008, 11:55:25 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAfile.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfile.c
r19005 r19007 13 13 #include "pmHDU.h" 14 14 #include "pmFPA.h" 15 #include "pmHDUUtils.h" 15 16 #include "pmFPALevel.h" 16 17 #include "pmFPAview.h" … … 182 183 newName = psStringCopy(rule); 183 184 184 if (strstr (newName, "{FPA.OBS}") != NULL) {185 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.OBS");186 if (name != NULL) {185 if (strstr(newName, "{FPA.OBS}")) { 186 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.OBS"); 187 if (name) { 187 188 psStringSubstitute(&newName, name, "{FPA.OBS}"); 188 189 } 189 190 } 190 if (strstr (newName, "{FPA.NAME}") != NULL) {191 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.NAME");192 if (name != NULL) {191 if (strstr(newName, "{FPA.NAME}")) { 192 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.NAME"); 193 if (name) { 193 194 psStringSubstitute(&newName, name, "{FPA.NAME}"); 194 195 } 195 196 } 196 if (strstr (newName, "{CHIP.NAME}") != NULL) {197 pmChip *chip = pmFPAviewThisChip (view, fpa);198 if (chip != NULL) {199 char *name = psMetadataLookupStr (NULL, chip->concepts, "CHIP.NAME");200 if (name != NULL) {197 if (strstr(newName, "{CHIP.NAME}")) { 198 pmChip *chip = pmFPAviewThisChip(view, fpa); 199 if (chip) { 200 char *name = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 201 if (name) { 201 202 psStringSubstitute(&newName, name, "{CHIP.NAME}"); 202 203 } 203 204 } 204 205 } 205 if (strstr (newName, "{CHIP.ID}") != NULL) {206 pmChip *chip = pmFPAviewThisChip (view, fpa);207 if (chip != NULL) {208 char *name = psMetadataLookupStr (NULL, chip->concepts, "CHIP.ID");209 if (name != NULL) {206 if (strstr(newName, "{CHIP.ID}")) { 207 pmChip *chip = pmFPAviewThisChip(view, fpa); 208 if (chip) { 209 char *name = psMetadataLookupStr(NULL, chip->concepts, "CHIP.ID"); 210 if (name) { 210 211 psStringSubstitute(&newName, name, "{CHIP.ID}"); 211 212 } 212 213 } 213 214 } 214 if (strstr (newName, "{CHIP.N}") != NULL) {215 if (strstr(newName, "{CHIP.N}")) { 215 216 char *name = NULL; 216 217 if (view->chip < 0) { 217 psStringAppend (&name, "XX");218 psStringAppend(&name, "XX"); 218 219 } else { 219 psStringAppend (&name, "%02d", view->chip);220 psStringAppend(&name, "%02d", view->chip); 220 221 } 221 222 psStringSubstitute(&newName, name, "{CHIP.N}"); 222 psFree (name);223 } 224 if (strstr (newName, "{CHIP.NUM}") != NULL) {223 psFree(name); 224 } 225 if (strstr(newName, "{CHIP.NUM}")) { 225 226 char *name = NULL; 226 227 if (view->chip < 0) { 227 psStringAppend (&name, "XX");228 psStringAppend(&name, "XX"); 228 229 } else { 229 psStringAppend (&name, "%d", view->chip); 230 int chipNum = view->chip; // Number of chip 231 // Potential correction for fortran (unit-indexed) numbering 232 pmChip *chip = pmFPAviewThisChip(view, fpa); // Chip of interest 233 pmHDU *hdu = pmHDUFromChip(chip); // Corresponding HDU 234 bool mdok; // Status of MD lookup 235 psMetadata *formats = psMetadataLookupMetadata(&mdok, hdu->format, "FORMATS"); // Special formats 236 if (mdok && formats) { 237 const char *format = psMetadataLookupStr(&mdok, formats, "CHIP.NUM"); // Format for CHIP.NUM 238 if (mdok && format && strcmp(format, "FORTRAN") == 0) { 239 chipNum++; 240 } 241 } 242 psStringAppend(&name, "%d", chipNum); 230 243 } 231 244 psStringSubstitute(&newName, name, "{CHIP.NUM}"); 232 psFree (name);233 } 234 if (strstr (newName, "{CELL.NAME}") != NULL) {235 pmCell *cell = pmFPAviewThisCell (view, fpa);236 if (cell != NULL) {237 char *name = psMetadataLookupStr (NULL, cell->concepts, "CELL.NAME");238 if (name != NULL) {245 psFree(name); 246 } 247 if (strstr(newName, "{CELL.NAME}")) { 248 pmCell *cell = pmFPAviewThisCell(view, fpa); 249 if (cell) { 250 char *name = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); 251 if (name) { 239 252 psStringSubstitute(&newName, name, "{CELL.NAME}"); 240 253 } 241 254 } 242 255 } 243 if (strstr (newName, "{CELL.N}") != NULL) {256 if (strstr(newName, "{CELL.N}")) { 244 257 char *name = NULL; 245 258 if (view->cell < 0) { 246 psStringAppend (&name, "XX");259 psStringAppend(&name, "XX"); 247 260 } else { 248 psStringAppend (&name, "%02d", view->cell);261 psStringAppend(&name, "%02d", view->cell); 249 262 } 250 263 psStringSubstitute(&newName, name, "{CELL.N}"); 251 264 } 252 if (strstr (newName, "{CELL.NUM}") != NULL) {265 if (strstr(newName, "{CELL.NUM}")) { 253 266 char *name = NULL; 254 267 if (view->cell < 0) { 255 psStringAppend (&name, "XX");268 psStringAppend(&name, "XX"); 256 269 } else { 257 psStringAppend (&name, "%d", view->cell); 270 int cellNum = view->cell; // Number of cell 271 // Potential correction for fortran (unit-indexed) numbering 272 pmCell *cell = pmFPAviewThisCell(view, fpa); // Cell of interest 273 pmHDU *hdu = pmHDUFromCell(cell); // Corresponding HDU 274 bool mdok; // Status of MD lookup 275 psMetadata *formats = psMetadataLookupMetadata(&mdok, hdu->format, "FORMATS"); // Special formats 276 if (mdok && formats) { 277 const char *format = psMetadataLookupStr(&mdok, formats, "CELL.NUM"); // Format for CELL.NUM 278 if (mdok && format && strcmp(format, "FORTRAN") == 0) { 279 cellNum++; 280 } 281 } 282 psStringAppend(&name, "%d", cellNum); 258 283 } 259 284 psStringSubstitute(&newName, name, "{CELL.NUM}"); 260 285 } 261 if (strstr (newName, "{EXTNAME}") != NULL) {262 pmHDU *hdu = pmFPAviewThisHDU (view, fpa);286 if (strstr(newName, "{EXTNAME}")) { 287 pmHDU *hdu = pmFPAviewThisHDU(view, fpa); 263 288 if (hdu->extname && *hdu->extname) { 264 289 psStringSubstitute(&newName, hdu->extname, "{EXTNAME}"); 265 290 } 266 291 } 267 if (strstr (newName, "{FILTER}") != NULL) { 268 if (fpa != NULL) { 269 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.FILTER"); 270 if (name && *name) { 271 psStringSubstitute(&newName, name, "{FILTER}"); 272 } 273 } 274 } 275 if (strstr (newName, "{FILTER.ID}") != NULL) { 276 if (fpa != NULL) { 277 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.FILTERID"); 278 if (name && *name) { 279 psStringSubstitute(&newName, name, "{FILTER.ID}"); 280 } 281 } 282 } 283 if (strstr (newName, "{CAMERA}") != NULL) { 284 if (fpa != NULL) { 285 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.INSTRUMENT"); 286 if (name && *name) { 287 psStringSubstitute(&newName, name, "{CAMERA}"); 288 } 289 } 290 } 291 if (strstr (newName, "{INSTRUMENT}") != NULL) { 292 if (fpa != NULL) { 293 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.INSTRUMENT"); 294 if (name && *name) { 295 psStringSubstitute(&newName, name, "{INSTRUMENT}"); 296 } 297 } 298 } 299 if (strstr (newName, "{DETECTOR}") != NULL) { 300 if (fpa != NULL) { 301 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.DETECTOR"); 302 if (name && *name) { 303 psStringSubstitute(&newName, name, "{DETECTOR}"); 304 } 305 } 306 } 307 if (strstr (newName, "{TELESCOPE}") != NULL) { 308 if (fpa != NULL) { 309 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.TELESCOPE"); 310 if (name && *name) { 311 psStringSubstitute(&newName, name, "{TELESCOPE}"); 312 } 292 if (strstr(newName, "{FILTER}") && fpa) { 293 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.FILTER"); 294 if (name && *name) { 295 psStringSubstitute(&newName, name, "{FILTER}"); 296 } 297 } 298 if (strstr(newName, "{FILTER.ID}") && fpa) { 299 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.FILTERID"); 300 if (name && *name) { 301 psStringSubstitute(&newName, name, "{FILTER.ID}"); 302 } 303 } 304 if (strstr(newName, "{CAMERA}") && fpa) { 305 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.INSTRUMENT"); 306 if (name && *name) { 307 psStringSubstitute(&newName, name, "{CAMERA}"); 308 } 309 } 310 if (strstr(newName, "{INSTRUMENT}") && fpa) { 311 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.INSTRUMENT"); 312 if (name && *name) { 313 psStringSubstitute(&newName, name, "{INSTRUMENT}"); 314 } 315 } 316 if (strstr(newName, "{DETECTOR}") && fpa) { 317 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.DETECTOR"); 318 if (name && *name) { 319 psStringSubstitute(&newName, name, "{DETECTOR}"); 320 } 321 } 322 if (strstr(newName, "{TELESCOPE}") && fpa) { 323 char *name = psMetadataLookupStr(NULL, fpa->concepts, "FPA.TELESCOPE"); 324 if (name && *name) { 325 psStringSubstitute(&newName, name, "{TELESCOPE}"); 313 326 } 314 327 }
Note:
See TracChangeset
for help on using the changeset viewer.
