DAS  3.1.6 - 18/09/2017
Functions | Variables
Save.c File Reference
#include <io.h>
#include <fcntl.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "mgui.h"
#include "DAS_Spatram.h"
#include "dcl.h"
#include "dil.h"
#include "bil.h"
#include "DOAS.h"
+ Include dependency graph for Save.c:

Go to the source code of this file.

Functions

void AssignNewH ()
 
void D_Print_BIL_H_BIN (int mod, int fd)
 
void D_PrintH_ASCII (int mod, FILE *fff)
 
void D_PrintH_BIN (int mod, int fd)
 
void D_PrintHMod (FILE *fff)
 Print the header in Column format. More...
 
int D_save_asc (char *fname, int s)
 
int D_save_bif (char *f, int s)
 
int D_save_bin (char *f, int s)
 
int D_WriteInitLog (char *str)
 writes devices errors(AMS, CCD...) on the Devices.log file.
More...
 
int DB_Column (char *sourcefilename)
 Column format. More...
 
void DB_Save (char *tit, int mod)
 Save the acquired spectrum. Procedure that Save the acquired spectrum. More...
 
void DB_save_img (char *tit, int mod)
 Saving image. Procedure for saving the CCD Image Used until version 2.0.9, Since 2.1.0 D_Saving(void) is used. More...
 
void getdate (struct date *tp)
 get current date
More...
 
void GetDateTime (struct date *dp, struct time *tp, struct tm *when)
 
void gettime (struct time *tp)
 get current time
More...
 
int ReadHeaderOldF (FILE *fd)
 read the ASCII header of the stored spectrum (OLD FORMAT - replaced by ReadHeaderOnly(FILE *fd) More...
 
int ReadHeaderOnly (FILE *fd)
 read the ASCII header of the stored spectrum More...
 
int SaveDataOffLine (char *fname, int mod)
 
int SmoothData (unsigned short *source, float *destination, int horpix, int verpix, int filw, int bp)
 Calc. the smoothed matrix of an unsigned short one.
. More...
 
int SmoothFloatData (float *source, float *destination, int horpix, int verpix, int filw, int bp)
 Calc. the smoothed matrix of a float one.
. More...
 
void UPS_Status (void)
 
void WriteColumn (int mod, FILE *fd)
 
void WriteSelColandSmoothed (int mod, FILE *fd, int selcol)
 write selected Column More...
 

Variables

bil BIL
 
config Cfg
 
ccd DC_CCD
 
ptf DC_HP
 
doas DOAS
 
flag FLAG
 flags structure More...
 
GratingSt GRS
 Grating. More...
 
hdrsp HDRSP
 

Function Documentation

§ AssignNewH()

void AssignNewH ( )

Definition at line 279 of file Save.c.

280 {
281 
282 }

§ D_Print_BIL_H_BIN()

void D_Print_BIL_H_BIN ( int  mod,
int  fd 
)

Definition at line 284 of file Save.c.

References spectrumheader::altitude, spectrumheader::ccdex, spectrumheader::ccdey, spectrumheader::ccdmax, spectrumheader::ccdnr, spectrumheader::ccdsx, spectrumheader::ccdsy, spectrumheader::ccdtemp, spectrumheader::ccdtexp, spectrumheader::ccdvb, spectrumheader::ccdwx, spectrumheader::ccdwy, spectrumheader::comment, spectrumheader::DATE, spectrumheader::dummy1, spectrumheader::dummy2, spectrumheader::dummy3, spectrumheader::dummy4, spectrumheader::filpos, spectrumheader::imgtype, spectrumheader::latitude, spectrumheader::location, spectrumheader::longitude, spectrumheader::mirpos, bil::SPH, spectrumheader::sza, spectrumheader::TIME, and spectrumheader::wavelen.

Referenced by SaveDataOffLine().

285 {
286  unsigned long info = 0;
287 
288 
289  info += write(fd, &BIL.SPH.location, sizeof(BIL.SPH.location));
290  info += write(fd, &BIL.SPH.latitude, sizeof(BIL.SPH.latitude));
291  info += write(fd, &BIL.SPH.longitude, sizeof(BIL.SPH.longitude));
292  info += write(fd, &BIL.SPH.altitude, sizeof(BIL.SPH.altitude));
293  info += write(fd, &BIL.SPH.sza, sizeof(BIL.SPH.sza));
294 
295  info += write(fd, &BIL.SPH.DATE, sizeof(struct ddate));
296  info += write(fd, &BIL.SPH.TIME, sizeof(struct dtime));
297 
298  info += write(fd, &BIL.SPH.mirpos, sizeof(BIL.SPH.mirpos));
299  info += write(fd, &BIL.SPH.wavelen, sizeof(BIL.SPH.wavelen));
300 
301  info += write(fd, &BIL.SPH.filpos, sizeof(BIL.SPH.filpos));
302  info += write(fd, &BIL.SPH.ccdtemp, sizeof(BIL.SPH.ccdtemp));
303  info += write(fd, &BIL.SPH.ccdtexp, sizeof(BIL.SPH.ccdtexp));
304  info += write(fd, &BIL.SPH.ccdmax, sizeof(BIL.SPH.ccdmax));
305 
306  info += write(fd, &BIL.SPH.imgtype, sizeof(BIL.SPH.imgtype));
307  info += write(fd, &BIL.SPH.ccdwx, sizeof(BIL.SPH.ccdwx));
308  info += write(fd, &BIL.SPH.ccdwy, sizeof(BIL.SPH.ccdwy));
309  info += write(fd, &BIL.SPH.ccdsx, sizeof(BIL.SPH.ccdsx));
310  info += write(fd, &BIL.SPH.ccdsy, sizeof(BIL.SPH.ccdsy));
311  info += write(fd, &BIL.SPH.ccdex, sizeof(BIL.SPH.ccdex));
312  info += write(fd, &BIL.SPH.ccdey, sizeof(BIL.SPH.ccdey));
313  info += write(fd, &BIL.SPH.ccdvb, sizeof(BIL.SPH.ccdvb));
314  info += write(fd, &BIL.SPH.ccdnr, sizeof(BIL.SPH.ccdnr));
315  info += write(fd, &BIL.SPH.dummy1, sizeof(BIL.SPH.dummy1));
316  info += write(fd, &BIL.SPH.dummy2, sizeof(BIL.SPH.dummy2));
317  info += write(fd, &BIL.SPH.dummy3, sizeof(BIL.SPH.dummy3));
318  info += write(fd, &BIL.SPH.dummy4, sizeof(BIL.SPH.dummy4));
319  info += write(fd, &BIL.SPH.comment, sizeof(BIL.SPH.comment));
320 
321 }
struct ddate DATE
Definition: bildef.h:134
char comment[255]
Definition: bildef.h:157
unsigned int ccdmax
Definition: bildef.h:142
Definition: bildef.h:83
unsigned int altitude
Altitude of the Station.
Definition: bildef.h:131
Definition: Dildef.h:423
spectrumheader SPH
Spectrum Header Structure.
Definition: bildef.h:256
char filpos[5]
Definition: bildef.h:139
bil BIL
Definition: Save.c:26
char mirpos[8]
Definition: bildef.h:137
struct dtime TIME
Definition: bildef.h:133
Definition: bildef.h:77
float ccdtexp
Definition: bildef.h:140
float longitude
Longitude of the Station.
Definition: bildef.h:130
float latitude
Latitude of the Station.
Definition: bildef.h:129
char location[4]
Name of the Station (BLQ, LPA, EVR, TNB, DMC.....)
Definition: bildef.h:128
float ccdtemp
Definition: bildef.h:141
float sza
Solar Zenith Angle.
Definition: bildef.h:132
+ Here is the caller graph for this function:

§ D_PrintH_ASCII()

void D_PrintH_ASCII ( int  mod,
FILE *  fff 
)

Definition at line 362 of file Save.c.

References hdrsp::ccdnr, hdrsp::ccdtemp, hdrsp::ccdtexp, hdrsp::ccdvbin, hdrsp::ccdwx, hdrsp::ccdwy, hdrsp::ccdxe, hdrsp::ccdxs, hdrsp::ccdye, hdrsp::ccdys, hdrsp::comment, date::da_day, date::da_mon, date::da_year, hdrsp::DATE, hdrsp::dummy1, hdrsp::dummy2, hdrsp::dummy3, hdrsp::dummy4, hdrsp::filpos, hdrsp::imgfmt, hdrsp::imgmax, hdrsp::imgmin, hdrsp::lambda, hdrsp::mirpos, hdrsp::s_alt, hdrsp::s_latitude, hdrsp::s_longitude, hdrsp::s_name, hdrsp::s_sza, time::ti_hour, time::ti_min, time::ti_sec, and hdrsp::TIME.

Referenced by D_save_asc().

363 {
364 
365  fprintf(fff, "LOC: %s ", HDRSP.s_name); //Name of the station
366  fprintf(fff, "LAT: %.2lf ", HDRSP.s_latitude);//Station latitude
367  fprintf(fff, "LON: %.2lf ", HDRSP.s_longitude);//Station longitude
368  fprintf(fff, "ALT[m/asl]: %u ", HDRSP.s_alt);//Station altitude
369  fprintf(fff, "SZA: %.2lf\n", HDRSP.s_sza);//SZA
370  fprintf(fff, "%d/%02d/%02d ", HDRSP.DATE.da_year, HDRSP.DATE.da_mon, HDRSP.DATE.da_day);
371  fprintf(fff, "%02d:%02d:%02d LT ",HDRSP.TIME.ti_hour, HDRSP.TIME.ti_min,HDRSP.TIME.ti_sec);
372  fprintf(fff, "%s ", HDRSP.mirpos);
373  fprintf(fff, "%d ", HDRSP.lambda);
374  fprintf(fff, "%s ", HDRSP.filpos);
375  fprintf(fff, "%.2lf ", HDRSP.ccdtemp);
376  fprintf(fff, "%.2lf ", HDRSP.ccdtexp);
377  fprintf(fff, "%5u ", HDRSP.imgmax);
378  fprintf(fff, "%5u\n", HDRSP.imgmin);
379 
380  fprintf(fff, "%d ", HDRSP.imgfmt); //Image Format
381  fprintf(fff, "%d ", HDRSP.ccdwx); //X Pixel Tot Number
382  fprintf(fff, "%d ", HDRSP.ccdwy); //Y Pixel Tot Number
383  fprintf(fff, "%d ", HDRSP.ccdxs); //Window X Start
384  fprintf(fff, "%d ", HDRSP.ccdys); //Window Y Start
385  fprintf(fff, "%d ", HDRSP.ccdxe); //Window X End
386  fprintf(fff, "%d ", HDRSP.ccdye); //Window Y End
387  fprintf(fff, "%d ", HDRSP.ccdvbin); // Vertical Binning
388  fprintf(fff, "%d ", HDRSP.ccdnr); // rows number
389 
390  fprintf(fff, "%d ", HDRSP.dummy1);
391  fprintf(fff, "%d ", HDRSP.dummy2);
392  fprintf(fff, "%d ", HDRSP.dummy3);
393  fprintf(fff, "%d\n", HDRSP.dummy4);
394  fprintf(fff, "%s\n", HDRSP.comment);
395 
396 }
unsigned int imgmin
Image minimum value.
Definition: Dildef.h:710
int ccdwy
Total Number of Y Pixels.
Definition: Dildef.h:693
U8 da_mon
Definition: Dildef.h:243
U8 ti_sec
Definition: Dildef.h:238
int ccdwx
Total Number of X Pixels.
Definition: Dildef.h:692
int dummy4
Definition: Dildef.h:716
int dummy3
Definition: Dildef.h:715
struct date DATE
Registration date.
Definition: Dildef.h:701
int ccdys
Y Start.
Definition: Dildef.h:695
float ccdtemp
CCD Temperature.
Definition: Dildef.h:707
int ccdxe
X End.
Definition: Dildef.h:696
S16 da_year
Definition: Dildef.h:241
U8 da_day
Definition: Dildef.h:242
U8 ti_hour
Definition: Dildef.h:236
unsigned int s_alt
station altitude
Definition: Dildef.h:722
float s_longitude
station longitude
Definition: Dildef.h:720
struct time TIME
Registration time.
Definition: Dildef.h:700
char * comment
comment
Definition: Dildef.h:717
int imgfmt
Image format: 0 = ASCII, 1 = BIN.
Definition: Dildef.h:688
int dummy2
Definition: Dildef.h:714
int ccdnr
Row number (ccdyoff-ccdwx)/ccdvbin.
Definition: Dildef.h:699
float s_sza
sun solar zenith angles
Definition: Dildef.h:724
hdrsp HDRSP
Definition: Save.c:23
float s_latitude
station latitude
Definition: Dildef.h:719
const char * filpos
Filter position.
Definition: Dildef.h:705
char s_name[4]
station localization
Definition: Dildef.h:721
U8 ti_min
Definition: Dildef.h:235
char mirpos[8]
Mirror position.
Definition: Dildef.h:702
int ccdye
Y End.
Definition: Dildef.h:697
int dummy1
Definition: Dildef.h:713
int ccdxs
X Start.
Definition: Dildef.h:694
int lambda
wavelength value
Definition: Dildef.h:704
float ccdtexp
ccd Exposure time
Definition: Dildef.h:708
unsigned int imgmax
Image maximum value.
Definition: Dildef.h:709
int ccdvbin
Vertical binning value.
Definition: Dildef.h:698
+ Here is the caller graph for this function:

§ D_PrintH_BIN()

void D_PrintH_BIN ( int  mod,
int  fd 
)

Definition at line 323 of file Save.c.

References hdrsp::bincomment, hdrsp::binfilpos, hdrsp::binmirpos, hdrsp::ccdnr, hdrsp::ccdtemp, hdrsp::ccdtexp, hdrsp::ccdvbin, hdrsp::ccdwx, hdrsp::ccdwy, hdrsp::ccdxe, hdrsp::ccdxs, hdrsp::ccdye, hdrsp::ccdys, hdrsp::DATE, hdrsp::dummy1, hdrsp::dummy2, hdrsp::dummy3, hdrsp::dummy4, hdrsp::imgfmt, hdrsp::imgmax, hdrsp::lambda, hdrsp::s_alt, hdrsp::s_latitude, hdrsp::s_longitude, hdrsp::s_name, hdrsp::s_sza, and hdrsp::TIME.

Referenced by D_save_bif().

324 {
325  unsigned long info = 0;
326 
327 
328  info += write(fd, &HDRSP.s_name, sizeof(HDRSP.s_name));
329  info += write(fd, &HDRSP.s_latitude, sizeof(HDRSP.s_latitude));
330  info += write(fd, &HDRSP.s_longitude, sizeof(HDRSP.s_longitude));
331  info += write(fd, &HDRSP.s_alt, sizeof(HDRSP.s_alt));
332  info += write(fd, &HDRSP.s_sza, sizeof(HDRSP.s_sza));
333 
334  info += write(fd, &HDRSP.DATE, sizeof(struct date));
335  info += write(fd, &HDRSP.TIME, sizeof(struct time));
336 
337  info += write(fd, &HDRSP.binmirpos, sizeof(HDRSP.binmirpos));
338  info += write(fd, &HDRSP.lambda, sizeof(HDRSP.lambda));
339 
340  info += write(fd, &HDRSP.binfilpos, sizeof(HDRSP.binfilpos));
341  info += write(fd, &HDRSP.ccdtemp, sizeof(HDRSP.ccdtemp));
342  info += write(fd, &HDRSP.ccdtexp, sizeof(HDRSP.ccdtexp));
343  info += write(fd, &HDRSP.imgmax, sizeof(HDRSP.imgmax));
344 
345  info += write(fd, &HDRSP.imgfmt, sizeof(HDRSP.imgfmt));
346  info += write(fd, &HDRSP.ccdwx, sizeof(HDRSP.ccdwx));
347  info += write(fd, &HDRSP.ccdwy, sizeof(HDRSP.ccdwy));
348  info += write(fd, &HDRSP.ccdxs, sizeof(HDRSP.ccdxs));
349  info += write(fd, &HDRSP.ccdys, sizeof(HDRSP.ccdys));
350  info += write(fd, &HDRSP.ccdxe, sizeof(HDRSP.ccdxe));
351  info += write(fd, &HDRSP.ccdye, sizeof(HDRSP.ccdye));
352  info += write(fd, &HDRSP.ccdvbin, sizeof(HDRSP.ccdvbin));
353  info += write(fd, &HDRSP.ccdnr, sizeof(HDRSP.ccdnr));
354  info += write(fd, &HDRSP.dummy1, sizeof(HDRSP.dummy1));
355  info += write(fd, &HDRSP.dummy2, sizeof(HDRSP.dummy2));
356  info += write(fd, &HDRSP.dummy3, sizeof(HDRSP.dummy3));
357  info += write(fd, &HDRSP.dummy4, sizeof(HDRSP.dummy4));
358  info += write(fd, &HDRSP.bincomment, sizeof(HDRSP.bincomment));
359 
360 }
int ccdwy
Total Number of Y Pixels.
Definition: Dildef.h:693
int ccdwx
Total Number of X Pixels.
Definition: Dildef.h:692
int dummy4
Definition: Dildef.h:716
int dummy3
Definition: Dildef.h:715
struct date DATE
Registration date.
Definition: Dildef.h:701
int ccdys
Y Start.
Definition: Dildef.h:695
float ccdtemp
CCD Temperature.
Definition: Dildef.h:707
Definition: Dildef.h:423
int ccdxe
X End.
Definition: Dildef.h:696
unsigned int s_alt
station altitude
Definition: Dildef.h:722
float s_longitude
station longitude
Definition: Dildef.h:720
struct time TIME
Registration time.
Definition: Dildef.h:700
char binmirpos[8]
Mirror position.
Definition: Dildef.h:703
int imgfmt
Image format: 0 = ASCII, 1 = BIN.
Definition: Dildef.h:688
int dummy2
Definition: Dildef.h:714
int ccdnr
Row number (ccdyoff-ccdwx)/ccdvbin.
Definition: Dildef.h:699
Definition: Dildef.h:240
float s_sza
sun solar zenith angles
Definition: Dildef.h:724
char bincomment[255]
comment
Definition: Dildef.h:718
hdrsp HDRSP
Definition: Save.c:23
float s_latitude
station latitude
Definition: Dildef.h:719
char binfilpos[5]
Filter position.
Definition: Dildef.h:706
char s_name[4]
station localization
Definition: Dildef.h:721
int ccdye
Y End.
Definition: Dildef.h:697
int dummy1
Definition: Dildef.h:713
int ccdxs
X Start.
Definition: Dildef.h:694
Definition: Dildef.h:234
int lambda
wavelength value
Definition: Dildef.h:704
float ccdtexp
ccd Exposure time
Definition: Dildef.h:708
unsigned int imgmax
Image maximum value.
Definition: Dildef.h:709
int ccdvbin
Vertical binning value.
Definition: Dildef.h:698
+ Here is the caller graph for this function:

§ D_PrintHMod()

void D_PrintHMod ( FILE *  fff)

Print the header in Column format.

Parameters
*fffdestination file number

Definition at line 790 of file Save.c.

References spectrumheader::altitude, spectrumheader::ccdex, spectrumheader::ccdey, spectrumheader::ccdmax, spectrumheader::ccdmin, spectrumheader::ccdnr, spectrumheader::ccdsx, spectrumheader::ccdsy, spectrumheader::ccdtemp, spectrumheader::ccdtexp, spectrumheader::ccdvb, spectrumheader::comment, ddate::da_day, ddate::da_mon, ddate::da_year, spectrumheader::DATE, spectrumheader::dummy1, spectrumheader::dummy2, spectrumheader::dummy3, spectrumheader::dummy4, spectrumheader::filpos, spectrumheader::imgtype, spectrumheader::latitude, spectrumheader::location, spectrumheader::longitude, spectrumheader::mirpos, bil::SPH, spectrumheader::sza, dtime::ti_hour, dtime::ti_min, dtime::ti_sec, spectrumheader::TIME, and spectrumheader::wavelen.

Referenced by WriteColumn(), and WriteSelColandSmoothed().

791 {
792 
793 // spectrumheader pe;
794 
795 /*
796  er = fscanf(fd, "%s%s%s%lf%s%lf%s%lf%s%lf", temp, BIL.SPH.location, temp, &BIL.SPH.latitude,
797  temp, &BIL.SPH.longitude, temp, &BIL.SPH.altitude, temp, &BIL.SPH.sza);
798 
799  er = fscanf(fd, "%i/%u/%u%u:%u:%u%s%s%d%s%lf%lf%lu%lu", &BIL.SPH.DATE.da_year,&BIL.SPH.DATE.da_mon,
800  &BIL.SPH.DATE.da_day, &BIL.SPH.TIME.ti_hour, &BIL.SPH.TIME.ti_min, &BIL.SPH.TIME.ti_sec, temp,
801  BIL.SPH.mirpos, &BIL.SPH.wavelen, BIL.SPH.filpos, &BIL.SPH.ccdtemp, &BIL.SPH.ccdtexp, &BIL.SPH.ccdmax,
802  &BIL.SPH.ccdmin);
803 
804  er = fscanf(fd, "%d%d%d%d%d%d%d%d%d%d%d", &BIL.SPH.imgtype, &BIL.SPH.ccdsx, &BIL.SPH.ccdsy, &BIL.SPH.ccdex,
805  &BIL.SPH.ccdey, &BIL.SPH.ccdvb, &BIL.SPH.ccdnr, &BIL.SPH.dummy1, &BIL.SPH.dummy2, &BIL.SPH.dummy3, &BIL.SPH.dummy4);
806 
807  er = fscanf(fd, "%s", BIL.SPH.comment);
808 */
809 
810 
811  fprintf(fff, "LOC: %s ", BIL.SPH.location); //Name of the station
812  fprintf(fff, "LAT: %.2lf ", BIL.SPH.latitude);//Station latitude
813  fprintf(fff, "LON: %.2lf ", BIL.SPH.longitude);//Station latitude
814  fprintf(fff, "ALT[m/asl]: %u ", BIL.SPH.altitude);//Station altitude
815  fprintf(fff, "SZA: %.2lf\n", BIL.SPH.sza);//SZA
816 
817  fprintf(fff, "%d/%02d/%02d ", BIL.SPH.DATE.da_year, BIL.SPH.DATE.da_mon, BIL.SPH.DATE.da_day);
818  fprintf(fff, "%02d:%02d:%02d LT ",BIL.SPH.TIME.ti_hour, BIL.SPH.TIME.ti_min,BIL.SPH.TIME.ti_sec);
819  fprintf(fff, "%s ", BIL.SPH.mirpos);
820  fprintf(fff, "%d ", BIL.SPH.wavelen);
821  fprintf(fff, "%s ", BIL.SPH.filpos);
822  fprintf(fff, "%.2lf ", BIL.SPH.ccdtemp);
823  fprintf(fff, "%.2lf ", BIL.SPH.ccdtexp);
824  fprintf(fff, "%5u ", BIL.SPH.ccdmax);
825  fprintf(fff, "%5u\n", BIL.SPH.ccdmin);
826 
827 
828  // Image format
829  fprintf(fff, "%d ", BIL.SPH.imgtype);
830 // BIL.SPH.imgtype =
831 // BIL.SPH.camtype =
832 // BIL.SPH.ccdtype =
833  fprintf(fff, "%d ", BIL.SPH.ccdsx);
834  fprintf(fff, "%d ", BIL.SPH.ccdsy);
835  fprintf(fff, "%d ", BIL.SPH.ccdex);
836  fprintf(fff, "%d ", BIL.SPH.ccdey);
837  fprintf(fff, "%d ", BIL.SPH.ccdvb);
838  fprintf(fff, "%d ", BIL.SPH.ccdnr);
839  fprintf(fff, "%d ", BIL.SPH.dummy1);
840  fprintf(fff, "%d ", BIL.SPH.dummy2);
841  fprintf(fff, "%d ", BIL.SPH.dummy3);
842  fprintf(fff, "%d\n", BIL.SPH.dummy4);
843  fprintf(fff, "%s\n", BIL.SPH.comment);
844 
845 
846 }
struct ddate DATE
Definition: bildef.h:134
char comment[255]
Definition: bildef.h:157
unsigned int ccdmax
Definition: bildef.h:142
unsigned int altitude
Altitude of the Station.
Definition: bildef.h:131
spectrumheader SPH
Spectrum Header Structure.
Definition: bildef.h:256
unsigned char ti_hour
Definition: bildef.h:79
unsigned char ti_sec
Definition: bildef.h:81
char filpos[5]
Definition: bildef.h:139
bil BIL
Definition: Save.c:26
char mirpos[8]
Definition: bildef.h:137
struct dtime TIME
Definition: bildef.h:133
float ccdtexp
Definition: bildef.h:140
unsigned char ti_min
Definition: bildef.h:78
float longitude
Longitude of the Station.
Definition: bildef.h:130
unsigned char da_mon
Definition: bildef.h:86
float latitude
Latitude of the Station.
Definition: bildef.h:129
unsigned char da_day
Definition: bildef.h:85
char location[4]
Name of the Station (BLQ, LPA, EVR, TNB, DMC.....)
Definition: bildef.h:128
short int da_year
Definition: bildef.h:84
float ccdtemp
Definition: bildef.h:141
unsigned int ccdmin
Definition: bildef.h:143
float sza
Solar Zenith Angle.
Definition: bildef.h:132
+ Here is the caller graph for this function:

§ D_save_asc()

int D_save_asc ( char *  fname,
int  s 
)

Definition at line 451 of file Save.c.

References D_PrintH_ASCII(), DIL, FLTIMG, FRdMat, image::Idx, image::Idy, dil::Img, INTIMG, image::Mat, img::type, URdMat, and VRange().

Referenced by DB_Save().

452 {
453  int x, y;
454  FILE *fd;
455  fd = fopen(fname, "a");
456  if(fd < 0) return 1;
457  VRange("Export as ASCII", 0);
458  // Print on file the header
459  D_PrintH_ASCII(0, fd);
460 
461  for(y = 0; y < DIL.Img.Idy[s]; y++)
462  {
463  for(x = 0; x < DIL.Img.Idx[s]; x++)
464  {
465  if((x % 10) == 0)
466  {
467  if(y == 0 && x == 0)
468  {
469  }
470  else
471  fprintf(fd, "\n", NULL);
472  }
473  if(DIL.Img.Mat[s].type == INTIMG)
474  fprintf(fd, "%5u ", URdMat(s, x, y));
475  if(DIL.Img.Mat[s].type == FLTIMG)
476  fprintf(fd, "%f ", FRdMat(s, x, y));
477  }
478 
479  if((y % 40) == 0 && y > 0)
480  VRange(NULL, (long) y * 100 / DIL.Img.Idy[s]);
481  }
482  fprintf(fd, "\n", NULL);
483  fclose(fd);
484  VRange(NULL, 100);
485  return 0;
486 }
U16 Idx[MAXIMG]
Definition: Dildef.h:570
dil DIL
Definition: 2DPlot.c:26
#define FLTIMG
Definition: Dildef.h:12
S16 type
Definition: Dildef.h:280
img Mat[MAXIMG]
Definition: Dildef.h:552
image Img
Definition: Dildef.h:675
#define INTIMG
Definition: Dildef.h:10
U16 Idy[MAXIMG]
Definition: Dildef.h:571
#define FRdMat(s, x, y)
Definition: Dildef.h:196
#define URdMat(s, x, y)
Definition: Dildef.h:192
void D_PrintH_ASCII(int mod, FILE *fff)
Definition: Save.c:362
C_DEF void VRange(char *str, int val)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D_save_bif()

int D_save_bif ( char *  f,
int  s 
)

Definition at line 398 of file Save.c.

References D_PrintH_BIN(), DIL, image::Idx, image::Idy, dil::Img, INTIMG, image::Mat, O_BINARY, raddeg, img::type, and URdMat.

Referenced by DB_Save().

399 {
400  unsigned long info = 0;
401  long l;
402  int fd, x, y;
403  char ffile[1024];
404 
405  double pi = 3.1415926535;
406  double raddeg = 57.29747;
407 
408 
409 // char *buf;
410 
411 
412 
413  // Find char "\" if present clear it
414  l = strlen(f);
415  while(f[l--] != 0x5C);
416  l += 2;
417  strcpy(ffile, &f[l]);
418 
419 
420  //fd = open(ffile, O_WRONLY | O_BINARY | O_CREAT, S_IWRITE);
421  fd = open(f, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, S_IWRITE);
422  if(fd < 0) return(-1);
423 
424 
425  // Print on file the header
426  D_PrintH_BIN(0, fd);
427 
428 
429 
430  if(DIL.Img.Mat[s].type == INTIMG)
431 
432  for(x = 0; x < DIL.Img.Idx[s]; x++)
433  {
434  for(y = 0; y < DIL.Img.Idy[s]; y++)
435  {
436  //temp = 10000 * sin((x+10)/raddeg);
437  //if(temp>= 0)
438  // URdMat(s, x, y) = 30000 - temp;
439  //else
440  // URdMat(s, x, y) = -temp + 30000;
441  info += write(fd, &URdMat(s, x, y), 2);
442  }
443  }
444  close(fd);
445 
446  return 0;
447 }
U16 Idx[MAXIMG]
Definition: Dildef.h:570
dil DIL
Definition: 2DPlot.c:26
#define O_BINARY
Definition: Dildef.h:201
S16 type
Definition: Dildef.h:280
Definition: Dildef.h:423
img Mat[MAXIMG]
Definition: Dildef.h:552
image Img
Definition: Dildef.h:675
void D_PrintH_BIN(int mod, int fd)
Definition: Save.c:323
#define INTIMG
Definition: Dildef.h:10
U16 Idy[MAXIMG]
Definition: Dildef.h:571
#define URdMat(s, x, y)
Definition: Dildef.h:192
static double raddeg
Definition: SOLPOS.C:133
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ D_save_bin()

int D_save_bin ( char *  f,
int  s 
)

Definition at line 177 of file Save.c.

References img::Bmat, img::CamName, img::CCDName, img::col, img::Ctrst, img::DATE, DIF_CAMERA, DIF_STAT, DIF_TIME, DIL, FLTIMG, img::Fmat, img::gain, img::Gmat, img::HBin, img::High, image::Idx, image::Idy, img::IHigh, img::ILow, img::Imat, dil::Img, img::InfoPar, INTIMG, img::Low, image::Mat, img::MaxNumbers, img::Media, O_BINARY, img::off, img::range, img::Rmat, img::SExp, img::Sigma, img::Sx, img::Sy, img::TAMB, img::TCCD, img::TIME, img::type, img::VBin, img::Wx, and img::Wy.

178 {
179  U32 info = 0, palet = 0;
180  U16 t, l;
181  int fd, c;
182  char ffile[1024];
183 
184 
185 
186  // Find char \ if present clear it
187  l = strlen(f);
188  while(f[l--] != 0x5C);
189  l += 2;
190  strcpy(ffile, &f[l]);
191 
192  //fd = open(f, O_WRONLY | O_BINARY | O_CREAT, S_IWRITE);
193  fd = open(f, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, S_IWRITE);
194  if(fd < 0) return(-1);
195 
196 // info += write(fd, &info, 4);
197 
198  info += write(fd, &palet, 4);
199 
200  info += write(fd, &DIL.Img.Idx[s], 2);
201  info += write(fd, &DIL.Img.Idy[s], 2);
202 
203  t = 0;
204  // Exp. code
205  info += write(fd, &t, 2);
206  // Image type
207  info += write(fd, &DIL.Img.Mat[s].type, 2);
208 
209  if(DIL.Img.Mat[s].col)
210  for(c = 0; c < DIL.Img.Idy[s]; c++)
211  {
212  info += write(fd, &DIL.Img.Mat[s].Rmat[c * DIL.Img.Idx[s]], DIL.Img.Idx[s] * 2);
213  info += write(fd, &DIL.Img.Mat[s].Gmat[c * DIL.Img.Idx[s]], DIL.Img.Idx[s] * 2);
214  info += write(fd, &DIL.Img.Mat[s].Bmat[c * DIL.Img.Idx[s]], DIL.Img.Idx[s] * 2);
215  }
216  if(DIL.Img.Mat[s].type == INTIMG)
217  for(c = 0; c < DIL.Img.Idy[s]; c++)
218  info += write(fd, &DIL.Img.Mat[s].Imat[c * DIL.Img.Idx[s]], DIL.Img.Idx[s] * 2);
219  if(DIL.Img.Mat[s].type == FLTIMG)
220  for(c = 0; c < DIL.Img.Idy[s]; c++)
221  info += write(fd, &DIL.Img.Mat[s].Fmat[c * DIL.Img.Idx[s]], DIL.Img.Idx[s] * 4);
222  // Image statistics
223  l = DIF_STAT; // Keyword
224  write(fd, &l, sizeof(U16));
225  {
226  write(fd, &DIL.Img.Mat[s].Ctrst, sizeof(char));
227  write(fd, &DIL.Img.Mat[s].Low, sizeof(float));
228  write(fd, &DIL.Img.Mat[s].High, sizeof(float));
229  write(fd, &DIL.Img.Mat[s].ILow, sizeof(float));
230  write(fd, &DIL.Img.Mat[s].IHigh, sizeof(float));
231  write(fd, &DIL.Img.Mat[s].Media, sizeof(float));
232  write(fd, &DIL.Img.Mat[s].Sigma, sizeof(float));
233  write(fd, &DIL.Img.Mat[s].MaxNumbers, sizeof(float));
234  }
235  if(DIL.Img.Mat[s].InfoPar)
236  {
237  // Camera parameter
238  l = DIF_CAMERA; // Keyword
239  write(fd, &l, sizeof(U16));
240  {
241  write(fd, &DIL.Img.Mat[s].CCDName, 20);
242  write(fd, &DIL.Img.Mat[s].CamName, 20);
243  write(fd, &DIL.Img.Mat[s].off, sizeof(S16));
244  write(fd, &DIL.Img.Mat[s].gain, sizeof(double));
245  write(fd, &DIL.Img.Mat[s].range, sizeof(S16));
246  write(fd, &DIL.Img.Mat[s].SExp, sizeof(double));
247  write(fd, &DIL.Img.Mat[s].TAMB, sizeof(S16));
248  write(fd, &DIL.Img.Mat[s].TCCD, sizeof(S16));
249  write(fd, &DIL.Img.Mat[s].HBin, sizeof(U16));
250  write(fd, &DIL.Img.Mat[s].VBin, sizeof(U16));
251  write(fd, &DIL.Img.Mat[s].Sx, sizeof(U16));
252  write(fd, &DIL.Img.Mat[s].Sy, sizeof(U16));
253  write(fd, &DIL.Img.Mat[s].Wx, sizeof(U16));
254  write(fd, &DIL.Img.Mat[s].Wy, sizeof(U16));
255  }
256  // Time date
257  l = DIF_TIME; // Keyword
258  write(fd, &l, sizeof(U16));
259  {
260 
261  write(fd, &DIL.Img.Mat[s].TIME, sizeof(struct time));
262  write(fd, &DIL.Img.Mat[s].DATE, sizeof(struct date));
263  }
264  }
265 
266  close(fd);
267 
268  if(DIL.Img.Mat[s].InfoPar)
269  {
270  // Write info position
271  fd = open(f, O_WRONLY | O_BINARY, S_IWRITE);
272  write(fd, &info, 4);
273  close(fd);
274  }
275  return 0;
276 }
U16 VBin
Definition: Dildef.h:337
float Sigma
Definition: Dildef.h:306
U16 Idx[MAXIMG]
Definition: Dildef.h:570
dil DIL
Definition: 2DPlot.c:26
char Ctrst
Definition: Dildef.h:304
#define O_BINARY
Definition: Dildef.h:201
#define DIF_STAT
Definition: Dildef.h:171
float MaxNumbers
Definition: Dildef.h:309
char CCDName[20]
Definition: Dildef.h:328
char InfoPar
Definition: Dildef.h:327
double gain
Definition: Dildef.h:331
#define DIF_TIME
Definition: Dildef.h:173
S16 off
Definition: Dildef.h:330
#define FLTIMG
Definition: Dildef.h:12
U16 * Imat
Definition: Dildef.h:286
U16 HBin
Definition: Dildef.h:336
S16 type
Definition: Dildef.h:280
U16 * Gmat
Definition: Dildef.h:289
Definition: Dildef.h:423
img Mat[MAXIMG]
Definition: Dildef.h:552
struct date DATE
Definition: Dildef.h:348
U16 * Rmat
Definition: Dildef.h:288
S16 range
Definition: Dildef.h:332
image Img
Definition: Dildef.h:675
U16 Wy
Definition: Dildef.h:343
short unsigned U16
2 byte without sign, range 0-65535
Definition: dcldef.h:375
S16 TAMB
Definition: Dildef.h:334
#define INTIMG
Definition: Dildef.h:10
U16 Idy[MAXIMG]
Definition: Dildef.h:571
unsigned long U32
4 byte without sign, range 0-4294967295
Definition: dcldef.h:376
U16 Sy
Definition: Dildef.h:341
Definition: Dildef.h:240
float IHigh
Definition: Dildef.h:303
U16 Sx
Definition: Dildef.h:340
S16 col
Definition: Dildef.h:284
float ILow
Definition: Dildef.h:302
double SExp
Definition: Dildef.h:333
short int S16
2 byte with sign, -32768+32767
Definition: dcldef.h:374
float * Fmat
Definition: Dildef.h:287
U16 Wx
Definition: Dildef.h:342
#define DIF_CAMERA
Definition: Dildef.h:172
Definition: Dildef.h:234
S16 TCCD
Definition: Dildef.h:335
struct time TIME
Definition: Dildef.h:347
char CamName[20]
Definition: Dildef.h:329
float Low
Definition: Dildef.h:294
U16 * Bmat
Definition: Dildef.h:290
float High
Definition: Dildef.h:295
float Media
Definition: Dildef.h:305

§ D_WriteInitLog()

int D_WriteInitLog ( char *  str)

writes devices errors(AMS, CCD...) on the Devices.log file.

Definition at line 144 of file Save.c.

Referenced by AMS_Error(), AMSINI_Err(), CCD_Error(), DAS_Error(), InitCCD_AMS(), InitTempAD(), Master_Error(), MGUIMain(), and WinRes().

145 {
146  FILE *fc;
147  char datebuf[9];
148  char timebuf[9];
149 
150  _strdate(datebuf);
151  _strtime(timebuf);
152 
153 
154  fc = fopen("LOG\\Devices.Log", "a");
155  if(fc < 0) return 1;
156 
157  fprintf(fc, " %s %s %s\n",datebuf, timebuf, str);
158 
159  fclose(fc);
160  return 0;
161 
162 }
+ Here is the caller graph for this function:

§ DB_Column()

int DB_Column ( char *  sourcefilename)

Column format.

Parameters
*sourcefilenamesource file name

Definition at line 1109 of file Save.c.

References AllocUSMat(), D_VRange(), DI_FindExtName(), bil::DPLOT, doas::FFTFilter, FilterData(), tools::FlagFilter, IDX, IDY, d_view::ImatGraf, O_BINARY, ReadHeader_ASCII(), ReadHeader_BIN(), ReadIMG(), ReadIMG_BIN(), SAVECNT, TOOLS, flag::Wl, and WriteColumn().

Referenced by D_PButt_CB(), and DT_ColFormat().

1110 {
1111 
1112 
1113  FILE *fs, *fd;
1114  char buf[256];
1115  int er = 0, k = 0;
1116  char string[4] = ".COL";
1117  int lunstr;
1118  char fext[4];
1119 
1120  int fb;
1121  fext[0] = '\0';
1122 
1123 // MMessageDialog("Full FileName:", nomefile, "ok", NULL);
1124 
1125  lunstr = strlen(sourcefilename);
1126  strcpy(buf,sourcefilename);
1127 
1128  strncpy( buf + (lunstr - 4), string, 4 );
1129 
1130  fd = fopen(buf, "a");
1131  if(fd < 0) return 1;
1132 
1133 
1134  DI_FindExtName(sourcefilename, fext);
1135 
1136  D_VRange("Column FORMAT processing", 0, 128, 254, 128);
1137 
1138 
1139  if( (strcmp(fext,".dat") == 0) |(strcmp(fext,".Dat") == 0) )
1140  {
1141  fs = fopen(sourcefilename, "r");
1142  if(fs < 0) return 1;
1143 
1144 
1145  while( !feof( fs ) )
1146  {
1147  /*
1148  mod = 1 --> Assign Header to plot labels
1149  mod = 0 --> Read header only
1150  */
1151  ReadHeader_ASCII(0, fs);
1152  if(BIL.DPLOT.ImatGraf == 0)
1154 
1155  ReadIMG(fs, BIL.DPLOT.ImatGraf, IDX, IDY);
1156 
1157  if(TOOLS.FlagFilter)
1159 
1160  WriteColumn( FLAG.Wl, fd);
1161  k++;
1162  if((k % 5) == 0 && k > 0)
1163  D_VRange(NULL, (long) k * 100 / SAVECNT , 128, 254, 128);
1164  }
1165 
1166 // D_VRange(NULL, 100, 128, 254, 128);
1167  fclose(fs);
1168  }
1169  else if( (strcmp(fext,".bif") == 0) | (strcmp(fext,".Bif") == 0) )
1170  {
1171  fb = open(sourcefilename, O_RDONLY | O_BINARY, S_IREAD );
1172 
1173  while( !eof( fb ) )
1174  {
1175 
1176  er = ReadHeader_BIN(fb);
1177 
1178  if(BIL.DPLOT.ImatGraf == 0)
1180 
1182 
1183  if(TOOLS.FlagFilter)
1185 
1186  WriteColumn( FLAG.Wl, fd);
1187  k++;
1188  if((k % 5) == 0 && k > 0)
1189  D_VRange(NULL, (long) k * 100 / SAVECNT , 128, 254, 128);
1190 
1191  }
1192 // D_VRange(NULL, 100, 128, 254, 128);
1193  close (fb);
1194 
1195  }
1196  D_VRange(NULL, 100, 128, 254, 128);
1197  fclose(fd);
1198 
1199  return 0;
1200 }
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
void WriteColumn(int mod, FILE *fd)
Definition: Save.c:850
void D_VRange(char *str, int val, int, int g, int b)
Create and display the status bar.
Definition: Utils.c:206
#define O_BINARY
Definition: Dildef.h:201
int Wl
Flag for the units on the X scale plot.
int FilterData(unsigned short *mat, int horpix, int verpix, int filw, int bp)
Definition: FFT.c:250
doas DOAS
Definition: Save.c:27
void ReadIMG(FILE *file, unsigned short *mat, int hp, int vp)
Read ASCII Image (Spectral Data only) .
Definition: Spat_Plot.c:1206
int ReadHeader_ASCII(int mod, FILE *fd)
Read ASCII Header of the measurement. .
Definition: Spat_Plot.c:1877
#define SAVECNT
maximum number of spectra in one file
d_view DPLOT
Definition: bildef.h:254
bil BIL
Definition: Save.c:26
int ReadHeader_BIN(int fd)
read the BINARY header of the stored spectrum
Definition: Spat_Plot.c:1798
void ReadIMG_BIN(int fd, unsigned short *mat, int hp, int vp)
read the BINARY stored spectrum
Definition: Spat_Plot.c:1166
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
int FFTFilter
Fast Fourier Trasform Filter windows.
Definition: DOASdef.h:25
int FlagFilter
flag for filterinf
unsigned short * ImatGraf
Definition: bildef.h:176
flag FLAG
flags structure
Definition: Save.c:25
C_DEF void DI_FindExtName(char *fullname, char *fext)
unsigned short * AllocUSMat(int hp, int vp)
Definition: Spat_Plot.c:1994
tools TOOLS
Definition: CreateForms.c:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ DB_Save()

void DB_Save ( char *  tit,
int  mod 
)

Save the acquired spectrum. Procedure that Save the acquired spectrum.

Parameters
*titpointer to the char variable with the file name
mod
  • = 0 –> ASCII
  • = 1 –> Binary

Definition at line 552 of file Save.c.

References D_BuildH(), D_save_asc(), D_save_bif(), DAS, img::DATE, DIL, DOASMODE, flag::exemode, das::Flag, GetDateTime(), dil::Img, image::Mat, OFFLINEPLOT, SaveDataOffLine(), Server, and img::TIME.

Referenced by D_PButt_CB(), D_Saving(), DB_HorComm_CB(), DB_KeyB_CB(), PopUp_CB(), and SaveCalib().

553 {
554  int er;
555  struct tm today;
556 
558  {
559  SaveDataOffLine(tit, mod);
560  }
561  else
562  {
564  // gettime( &DIL.Img.Mat[Server].TIME );
565  // getdate( &DIL.Img.Mat[Server].DATE );
566 
567  D_BuildH(mod, Server);
568 
569  if(mod) //save in binary mode
570  er = D_save_bif(tit, Server);
571  else //save in ASCII mode
572  er = D_save_asc(tit, Server);
573  }
574 
575 
576 
577 }
int Server
Definition: DAS_Spat.c:253
dil DIL
Definition: 2DPlot.c:26
int D_save_asc(char *fname, int s)
Definition: Save.c:451
void D_BuildH(int mod, int s)
Build Header of the measurements . .
Definition: Procedures.c:63
#define DOASMODE
execution for DOAS Processing
flag Flag
Structure for different flags.
das DAS
Definition: Chktemp.c:26
img Mat[MAXIMG]
Definition: Dildef.h:552
struct date DATE
Definition: Dildef.h:348
image Img
Definition: Dildef.h:675
#define OFFLINEPLOT
execution for archived data visualisation
int SaveDataOffLine(char *fname, int mod)
Definition: Save.c:493
void GetDateTime(struct date *dp, struct time *tp, struct tm *when)
Definition: Save.c:43
int D_save_bif(char *f, int s)
Definition: Save.c:398
struct time TIME
Definition: Dildef.h:347
int exemode
Set the Execution MODE (Execution modes)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ DB_save_img()

void DB_save_img ( char *  tit,
int  mod 
)

Saving image. Procedure for saving the CCD Image Used until version 2.0.9, Since 2.1.0 D_Saving(void) is used.

Parameters
*tit–> file name where the image will be saved
mod
  • = 1 –> binary
  • = 0 –> ASCII.
Returns
void

Definition at line 580 of file Save.c.

References FWS, IDX, IDY, MIS, O_BINARY, FilterWheelSt::Pos, MirrorSt::Pos, Status(), TExp, wl, and GratingSt::Wl.

581 {
582  int n;
583  FILE *fd;
584  int fh;
585 // struct date d;
586 // struct time t;
587  unsigned int y;
588 
589 
590  char tit1[64];
591  char datebuf[9];
592  char timebuf[9];
593  int Lambda;
594  int riga;
595 // int Idx, Idy, x, k,t,j;
596  int wl[] = {2823, 3337, 3850, 4358, 4861, 5332, 5814, 6282, 6734, 7201, 7677, 8195, 8622, 9023, 9405, 9758, 10066, 10358};
597  // char *filt[] = {{"NULL"},{"UG11"}, {"UG5 "}, {"BG25"}, {"BG39"}, {"GG45"}, {"BG12"}, {"NULL"}};
598 
599 
600  // char *PMirror[] = {{"PHOTOMETRIC"}, {"RADIOM. DX"}, {"DIRECT DX"},
601  // {"DIRECT SX"}, {"RADIOM. SX"}};
602 
603  Lambda = wl[GRS.Wl];
604 // Mirror = MIS.MirPos;
605 
606  //data e ora di memorizzazione dello spettro
607  _strdate(datebuf);
608  _strtime(timebuf);
609 
610  Status("Save Image");
611 
612 
613  if(mod) //binary mode
614  {
615  fh = open(tit, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, S_IWRITE);
616  if ( fh < 0) return;
617 
618  //Salva tutte le righe
619  riga = 1;
620  for(y = 0; y < (unsigned int)IDY; y++)
621  //Salva solo 5 righe centrali
622  //riga = 4;
623  //for(y = 3; y < (DAS.Paramini.ccdWy / DAS.Paramini.VBin) - 3; y++)
624 
625  {
626  write( fh, &datebuf, sizeof(datebuf));
627  write( fh, &timebuf, sizeof(timebuf));
628  write( fh, &MIS.Pos, sizeof(MIS.Pos));
629  write( fh, &Lambda, sizeof(Lambda));
630  write( fh, &FWS.Pos, sizeof(FWS.Pos));
631 
632  write( fh, &TExp, sizeof(TExp));
633  write( fh, &riga, sizeof(riga));
634  // fwrite( Temp, 1, sizeof(Temp), fd );
635  // Commento
636  sprintf(tit1, "%s", "Default comment");
637  write( fh, &tit1, sizeof(tit1));
638 
639 
640  for(n = 0; n < IDX; n++)
641  {
642 // Imat[y * DAS.Paramini.ccdWx + n] = n*2;
643 // write(fh, &Imat[y * DAS.Paramini.ccdWx + n], sizeof(Imat[y * DAS.Paramini.ccdWx + n]));
644  }
645  riga++;
646 
647 
648  }
649 
650  close(fh);
651  }
652  else
653  {
654  fd = fopen(tit, "a");
655  if(fd == NULL)
656  {
657  Status("Error opening file");
658  return;
659  }
660 
661  //Salva tutte le righe
662  riga = 1;
663  for(y = 0; y < (unsigned int)IDY; y++)
664  //Salva solo 5 righe centrali
665  //riga = 4;
666  //for(y = 3; y < (DAS.Paramini.ccdWy / DAS.Paramini.VBin) - 3; y++)
667 
668  {
669  fprintf(fd, "%s %s ", datebuf, timebuf);//data e ora //RTC
670  fprintf(fd, " %d ", MIS.Pos); //Posizione specchio
671  fprintf(fd, " %5d ", Lambda); //lunghezza d'onda
672  fprintf(fd, " %d ", FWS.Pos); //Posizione RUOTA FILTRI
673  fprintf(fd, " %.2lf ", TExp); //tempo di integrazione
674 // fprintf(fd, " %.1lf ", Temp); //Temperatura del CCD
675  fprintf(fd, " Riga:%d ", riga); //Numero riga
676 // fprintf(fd, " %d\n ", VAna[7]); // Pressione esterna
677  // Commento
678  sprintf(tit1, "%s", "Default comment");
679  fprintf(fd, " %s\n ", tit1 ); // Commento
680 
681  for(n = 0; n < IDX; n++)
682 
683  {
684 // Imat[y * DAS.Paramini.ccdWx + n]=n * 2;
685 // fprintf(fd, " %04u", Imat[y * DAS.Paramini.ccdWx + n]);
686  }
687  fprintf(fd,"\n");
688  riga++;
689 
690 
691  }
692  fclose(fd);
693 
694  }
695 
696 
697 
698 
699  return;
700 
701 }
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
#define O_BINARY
Definition: Dildef.h:201
int Pos
Mirror Current Position.
int Pos
Filter Wheel current Position.
int Wl
Grating Wavelength.
GratingSt GRS
Grating.
Definition: Save.c:24
void Status(char *tit)
Writes information&#39;s on the Status label .
Definition: Load.c:1556
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
double TExp
CCD Exposure time.
Definition: DAS_Spat.c:130
MirrorSt MIS
Mirror.
Definition: DAS_Spat.c:61
int wl[]
WaveLength definition - for SD_Grating.
Definition: DAS_Spat.c:182
FilterWheelSt FWS
Filter Wheel.
Definition: DAS_Spat.c:57
+ Here is the call graph for this function:

§ getdate()

void getdate ( struct date tp)

get current date

Definition at line 131 of file Save.c.

References date::da_day, date::da_mon, and date::da_year.

132 {
133  time_t now;
134  struct tm w;
135 
136  time(&now);
137  w = *localtime(&now);
138  tp->da_day = w.tm_mday;
139  tp->da_mon = w.tm_mon + 1;
140  tp->da_year = w.tm_year + 1900;
141 }
U8 da_mon
Definition: Dildef.h:243
S16 da_year
Definition: Dildef.h:241
U8 da_day
Definition: Dildef.h:242
Definition: Dildef.h:234

§ GetDateTime()

void GetDateTime ( struct date dp,
struct time tp,
struct tm *  when 
)

Definition at line 43 of file Save.c.

References date::da_day, date::da_mon, date::da_year, time::ti_hour, time::ti_hund, time::ti_min, and time::ti_sec.

Referenced by AutoR_No_Shutt(), AutoR_With_Shutt(), ChkMaster(), D_AutoExecution(), DB_GetCCD(), DB_Save(), E_Dark(), GetDefPix(), MGUIMain(), SetWindowsReset(), SZA_FirstCalc(), Task_LOG(), Task_Timer(), WinRes(), WriteAMSCB(), WriteOptioniniCB(), WriteParaminiCB(), and WritewlstepiniCB().

44 {
45 
46  time_t now;
47  struct tm w;
48 
49  time(&now);
50 
51  //This code retrive the PC clock time as it is
52  //(with or without the daylight saving time setted)
53  w = *localtime(&now);
54 
55  //This code retrive the PC clock and check if the daylight
56  //saving time is setted or not
57  //the time stored in the Header of the measurement is always the LST (Local Solar Time)
58  /**************************************************************/
59  // Check if daylight saving time is in effect
60  // tm_isdst > 0 if daylight saving time is in effect
61  // tm_isdst = 0 if daylight saving time is not in effect
62  // tm_isdst < 0 if status of daylight saving time is unknown.
63  if (w.tm_isdst)
64  {
65  now = now - 3600; // 1 hour less
66  w = *localtime( &now );
67 
68  }
69  //Time for Header of Measurement (Local Solar Time)
70  tp->ti_sec = w.tm_sec;
71  tp->ti_min = w.tm_min;
72  tp->ti_hour = w.tm_hour;
73  tp->ti_hund = 0;
74 
75  //Date for Header of Measurement
76  dp->da_day = w.tm_mday;
77  dp->da_mon = w.tm_mon + 1;
78  dp->da_year = w.tm_year + 1900;
79 
80  when -> tm_sec = w.tm_sec; /* seconds after the minute - [0,59] */
81  when -> tm_min = w.tm_min; /* minutes after the hour - [0,59] */
82  when -> tm_hour = w.tm_hour; /* hours since midnight - [0,23] */
83  when -> tm_mday = w.tm_mday; /* day of the month - [1,31] */
84  when -> tm_mon = w.tm_mon; /* months since January - [0,11] */
85  when -> tm_year = w.tm_year; /* years since 1900 */
86  when -> tm_wday = w.tm_wday; /* days since Sunday - [0,6] */
87  when -> tm_yday = w.tm_yday; /* days since January 1 - [0,365] */
88  when -> tm_isdst = w.tm_isdst; /* daylight savings time flag */
89 
90 }
U8 da_mon
Definition: Dildef.h:243
U8 ti_sec
Definition: Dildef.h:238
S16 da_year
Definition: Dildef.h:241
U8 da_day
Definition: Dildef.h:242
U8 ti_hour
Definition: Dildef.h:236
U8 ti_hund
Definition: Dildef.h:237
U8 ti_min
Definition: Dildef.h:235
Definition: Dildef.h:234
+ Here is the caller graph for this function:

§ gettime()

void gettime ( struct time tp)

get current time

Definition at line 92 of file Save.c.

References time::ti_hour, time::ti_hund, time::ti_min, and time::ti_sec.

93 {
94  time_t now;
95  struct tm w;
96 
97  time(&now);
98 
99  //This code retrive the PC clock time as it is
100  //(with or without the daylight saving time setted)
101  w = *localtime(&now);
102  tp->ti_sec = w.tm_sec;
103  tp->ti_min = w.tm_min;
104  tp->ti_hour = w.tm_hour;
105  tp->ti_hund = 0;
106 
107  //This code retrive the PC clock and check if the daylight
108  //saving time is setted or not
109  //the time stored in the Header of the measurement is always the LST (Local Solar Time)
110  /**************************************************************/
111  // Check if daylight saving time is in effect
112  // tm_isdst > 0 if daylight saving time is in effect
113  // tm_isdst = 0 if daylight saving time is not in effect
114  // tm_isdst < 0 if status of daylight saving time is unknown.
115  if (w.tm_isdst)
116  {
117  tp->ti_hour = w.tm_hour - 1;
118  }
119  //NOTE - In Daylight saving period on midnight the hours became -1 so...
120  // if((newtime.tm_hour) == -1)
121  //{
122  // Necessary for measurements performed at high latitude in summer seasons
123  // newtime.tm_hour = 23;
124  // newtime.tm_yday = newtime.tm_yday - 1;
125  //}
126 
127  /**************************************************************/
128 
129 
130 }
U8 ti_sec
Definition: Dildef.h:238
U8 ti_hour
Definition: Dildef.h:236
U8 ti_hund
Definition: Dildef.h:237
U8 ti_min
Definition: Dildef.h:235
Definition: Dildef.h:234

§ ReadHeaderOldF()

int ReadHeaderOldF ( FILE *  fd)

read the ASCII header of the stored spectrum (OLD FORMAT - replaced by ReadHeaderOnly(FILE *fd)

Parameters
fdnumber of source file

Definition at line 751 of file Save.c.

References spectrumheader::altitude, spectrumheader::ccdex, spectrumheader::ccdey, spectrumheader::ccdmax, spectrumheader::ccdmin, spectrumheader::ccdnr, spectrumheader::ccdsx, spectrumheader::ccdsy, spectrumheader::ccdtemp, spectrumheader::ccdtexp, spectrumheader::ccdvb, spectrumheader::comment, ddate::da_day, ddate::da_mon, ddate::da_year, spectrumheader::DATE, spectrumheader::dummy1, spectrumheader::dummy2, spectrumheader::dummy3, spectrumheader::dummy4, spectrumheader::filpos, spectrumheader::imgtype, spectrumheader::latitude, spectrumheader::location, spectrumheader::longitude, spectrumheader::mirpos, bil::SPH, spectrumheader::sza, dtime::ti_hour, dtime::ti_min, dtime::ti_sec, spectrumheader::TIME, and spectrumheader::wavelen.

Referenced by DT_CorrHeader().

752 {
753 
754  int er = 0;
755  char str[128], temp[4];
756 
757 
758 
759  if(feof( fd ))
760  {
761  return 1;
762  }
763  else
764  {
765  er = fscanf(fd, "%s%s%s%lf%s%lf%s%lf%s%lf", temp, BIL.SPH.location, temp, &BIL.SPH.latitude,
766  temp, &BIL.SPH.longitude, temp, &BIL.SPH.altitude, temp, &BIL.SPH.sza);
767 
768  er = fscanf(fd, "%i/%u/%u%u:%u:%u%s%s%d%s%lf%lf%lu%lu", &BIL.SPH.DATE.da_year,&BIL.SPH.DATE.da_mon,
771  &BIL.SPH.ccdmin);
772 
773  er = fscanf(fd, "%d%d%d%d%d%d%d%d%d%d%d", &BIL.SPH.imgtype,
774  &BIL.SPH.ccdsx, &BIL.SPH.ccdsy,
775  &BIL.SPH.ccdex, &BIL.SPH.ccdey,
776  &BIL.SPH.ccdvb, &BIL.SPH.ccdnr,
777  &BIL.SPH.dummy1,
778  &BIL.SPH.dummy2,
779  &BIL.SPH.dummy3,
780  &BIL.SPH.dummy4);
781 
782  er = fscanf(fd, "%s", BIL.SPH.comment);
783  fgets(str, 80, fd);
784 
785  }
786 
787  return 0;
788 }
struct ddate DATE
Definition: bildef.h:134
char comment[255]
Definition: bildef.h:157
unsigned int ccdmax
Definition: bildef.h:142
unsigned int altitude
Altitude of the Station.
Definition: bildef.h:131
spectrumheader SPH
Spectrum Header Structure.
Definition: bildef.h:256
unsigned char ti_hour
Definition: bildef.h:79
unsigned char ti_sec
Definition: bildef.h:81
char filpos[5]
Definition: bildef.h:139
bil BIL
Definition: Save.c:26
char mirpos[8]
Definition: bildef.h:137
struct dtime TIME
Definition: bildef.h:133
float ccdtexp
Definition: bildef.h:140
unsigned char ti_min
Definition: bildef.h:78
float longitude
Longitude of the Station.
Definition: bildef.h:130
unsigned char da_mon
Definition: bildef.h:86
float latitude
Latitude of the Station.
Definition: bildef.h:129
unsigned char da_day
Definition: bildef.h:85
char location[4]
Name of the Station (BLQ, LPA, EVR, TNB, DMC.....)
Definition: bildef.h:128
short int da_year
Definition: bildef.h:84
float ccdtemp
Definition: bildef.h:141
unsigned int ccdmin
Definition: bildef.h:143
float sza
Solar Zenith Angle.
Definition: bildef.h:132
+ Here is the caller graph for this function:

§ ReadHeaderOnly()

int ReadHeaderOnly ( FILE *  fd)

read the ASCII header of the stored spectrum

Parameters
fdnumber of source file

Definition at line 704 of file Save.c.

References spectrumheader::altitude, spectrumheader::ccdex, spectrumheader::ccdey, spectrumheader::ccdmax, spectrumheader::ccdmin, spectrumheader::ccdnr, spectrumheader::ccdsx, spectrumheader::ccdsy, spectrumheader::ccdtemp, spectrumheader::ccdtexp, spectrumheader::ccdvb, spectrumheader::ccdwx, spectrumheader::ccdwy, spectrumheader::comment, ddate::da_day, ddate::da_mon, ddate::da_year, spectrumheader::DATE, spectrumheader::dummy1, spectrumheader::dummy2, spectrumheader::dummy3, spectrumheader::dummy4, spectrumheader::filpos, spectrumheader::imgtype, spectrumheader::latitude, spectrumheader::location, spectrumheader::longitude, spectrumheader::mirpos, bil::SPH, spectrumheader::sza, dtime::ti_hour, dtime::ti_min, dtime::ti_sec, spectrumheader::TIME, and spectrumheader::wavelen.

Referenced by DT_CorrFileEvora().

705 {
706 
707  int er = 0;
708  char str[128], temp[12];
709  int NewnR = 0;
710 
711  if(feof( fd ))
712  {
713  return 1;
714  }
715  else
716  {
717 /*
718  er = fscanf(fd, "%s%s%s%f%s%f%s%u%s%f", temp, BIL.SPH.location, temp, &BIL.SPH.latitude,
719  temp, &BIL.SPH.longitude, temp, &BIL.SPH.altitude, temp, &BIL.SPH.sza);
720 
721  er = fscanf(fd, "%s %s %s %s %d %s %f %f %u %u", BIL.SPH.StrDate, BIL.SPH.StrTime, temp, BIL.SPH.mirpos, &BIL.SPH.wavelen,
722  BIL.SPH.filpos, &BIL.SPH.ccdtemp, &BIL.SPH.ccdtexp, &BIL.SPH.ccdmax,
723  &BIL.SPH.ccdmin);
724 
725  er = fscanf(fd, "%d%d%d%d%d%d%d%d%d%d%d%d%d", &BIL.SPH.imgtype, &BIL.SPH.ccdwx, &BIL.SPH.ccdwy,
726  &BIL.SPH.ccdsx, &BIL.SPH.ccdsy, &BIL.SPH.ccdex, &BIL.SPH.ccdey, &BIL.SPH.ccdvb,
727  &BIL.SPH.ccdnr, &BIL.SPH.dummy1, &BIL.SPH.dummy2, &BIL.SPH.dummy3, &BIL.SPH.dummy4);
728 
729 
730  */
731 
732  er = fscanf(fd, "%s%s%s%lf%s%lf%s%lf%s%lf", temp, BIL.SPH.location, temp, &BIL.SPH.latitude,
733  temp, &BIL.SPH.longitude, temp, &BIL.SPH.altitude, temp, &BIL.SPH.sza);
734 
735  er = fscanf(fd, "%i/%2u/%2u%2u:%2u:%2u%s%s%d%s%lf%lf%lu%lu", &BIL.SPH.DATE.da_year,
739 
740  er = fscanf(fd, "%d%d%d%d%d%d%d%d%d%d%d%d%d", &BIL.SPH.imgtype, &BIL.SPH.ccdwx, &BIL.SPH.ccdwy,
743 
744  er = fscanf(fd, "%s", BIL.SPH.comment);
745  fgets(str, 80, fd);
746  }
747 
748  return 0;
749 }
struct ddate DATE
Definition: bildef.h:134
char comment[255]
Definition: bildef.h:157
unsigned int ccdmax
Definition: bildef.h:142
unsigned int altitude
Altitude of the Station.
Definition: bildef.h:131
spectrumheader SPH
Spectrum Header Structure.
Definition: bildef.h:256
unsigned char ti_hour
Definition: bildef.h:79
unsigned char ti_sec
Definition: bildef.h:81
char filpos[5]
Definition: bildef.h:139
bil BIL
Definition: Save.c:26
char mirpos[8]
Definition: bildef.h:137
struct dtime TIME
Definition: bildef.h:133
float ccdtexp
Definition: bildef.h:140
unsigned char ti_min
Definition: bildef.h:78
float longitude
Longitude of the Station.
Definition: bildef.h:130
unsigned char da_mon
Definition: bildef.h:86
float latitude
Latitude of the Station.
Definition: bildef.h:129
unsigned char da_day
Definition: bildef.h:85
char location[4]
Name of the Station (BLQ, LPA, EVR, TNB, DMC.....)
Definition: bildef.h:128
short int da_year
Definition: bildef.h:84
float ccdtemp
Definition: bildef.h:141
unsigned int ccdmin
Definition: bildef.h:143
float sza
Solar Zenith Angle.
Definition: bildef.h:132
+ Here is the caller graph for this function:

§ SaveDataOffLine()

int SaveDataOffLine ( char *  fname,
int  mod 
)

Definition at line 493 of file Save.c.

References D_Print_BIL_H_ASCII(), D_Print_BIL_H_BIN(), bil::DPLOT, IDX, IDY, d_view::ImatOrig, O_BINARY, raddeg, WriteIMG(), and WriteIMG_BIN().

Referenced by DB_Save().

494 {
495 
496  unsigned long info = 0;
497  long l;
498  int fd;
499  char ffile[1024];
500  FILE *fn;
501 
502 
503  double pi = 3.1415926535;
504  double raddeg = 57.29747;
505 
506 
507 // char *buf;
508 
509 
510 
511  // Find char "\" if present clear it
512  l = strlen(fname);
513  while(fname[l--] != 0x5C);
514  l += 2;
515  strcpy(ffile, &fname[l]);
516 
517  if(mod) //save in binary mode
518  {
519  fd = open(fname, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, S_IWRITE);
520  if(fd < 0) return(-1);
521 
522  D_Print_BIL_H_BIN(0, fd);
523 
525 
526  close(fd);
527 
528 
529 
530  }
531  else //save in ASCII mode
532  {
533 
534  fn = fopen(fname, "a");
535  if(fn < 0) return 1;
536  // Print on file the header
537  D_Print_BIL_H_ASCII(0, fn);
538 
539  WriteIMG(fn, BIL.DPLOT.ImatOrig, IDX, IDY);
540 
541  fclose(fn);
542 
543 
544 
545  }
546 
547  return 0;
548 
549 }
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
void D_Print_BIL_H_BIN(int mod, int fd)
Definition: Save.c:284
#define O_BINARY
Definition: Dildef.h:201
Definition: Dildef.h:423
unsigned short * ImatOrig
Definition: bildef.h:180
void WriteIMG_BIN(int fd, unsigned short *mat, int hp, int vp)
Definition: Spat_Plot.c:1153
d_view DPLOT
Definition: bildef.h:254
bil BIL
Definition: Save.c:26
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
void WriteIMG(FILE *file, unsigned short *mat, int hp, int vp)
Definition: Spat_Plot.c:1178
static double raddeg
Definition: SOLPOS.C:133
void D_Print_BIL_H_ASCII(int mod, FILE *fff)
Definition: Utils.c:621
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ SmoothData()

int SmoothData ( unsigned short *  source,
float *  destination,
int  horpix,
int  verpix,
int  filw,
int  bp 
)

Calc. the smoothed matrix of an unsigned short one.
.

Parameters
*sourcesource data buffer
*destinationdestination data buffer
horpixhorizontal pixels
verpixvertical pixels
filwfilter windows for smoothing
bpblind pixels

Definition at line 973 of file Save.c.

References IDX, and SmoothingF().

Referenced by BuildLogRatio(), and WriteSelColandSmoothed().

975 {
976 
977  int x, y, n ;
978  double *avect;
979  unsigned long eln = (unsigned long)(2 * (horpix - bp + 1 )) ;
980  FILE *fd;
981 
982  avect = (double *) calloc( eln, sizeof(double));
983  if( avect == NULL )
984  return 1;
985 
986  for(y = 0; y < verpix; y++)
987  {
988  n=1;
989  for(x = 0; x < horpix; x++)
990  {
991  if ((x <= horpix - bp ) & (x > 1))
992  {
993  avect[n] = (double)source[y * (horpix) + x];
994  n++;
995  }
996  }
997 
998  SmoothingF(avect, n - 1, filw);
999 
1000  for(x = 0; x < horpix; x++)
1001  {
1002  if ((x <= horpix - bp ) & (x > 1))
1003  {
1004  destination[y * horpix + x] = (float) avect[x-1] ;
1005  }
1006 
1007  }
1008  }
1009 
1010  free(avect);
1011 
1012  fd = fopen("SmoothUS_In.tmp", "w");
1013  if(fd < 0) return 1;
1014 // for(x = 0; x < horpix + 1; x++)
1015  for(x = 0; x < horpix ; x++)
1016 
1017  {
1018  if ((x <= horpix - bp ) & (x > 1))
1019  {
1020  fprintf(fd, "%04u ", x);
1021 
1022  for(y = 0; y < verpix; y++)
1023  {
1024  fprintf(fd, "%05u ", source[y * IDX + x]);
1025  }
1026  fprintf(fd, "\n", NULL);
1027  }
1028  }
1029  fprintf(fd, "\n", NULL);
1030  fclose(fd);
1031 
1032 
1033  fd = fopen("SmoothUS_Out.tmp", "w");
1034  if(fd < 0) return 1;
1035 
1036 // for(x = 0; x < horpix + 1; x++)
1037  for(x = 0; x < horpix; x++)
1038 
1039  {
1040  if ((x <= horpix - bp ) & (x > 1))
1041  {
1042  fprintf(fd, "%04u ", x);
1043 
1044  for(y = 0; y < verpix; y++)
1045  {
1046  fprintf(fd, "%10.5lf ", destination[y * IDX + x]);
1047  }
1048  fprintf(fd, "\n", NULL);
1049  }
1050  }
1051  fprintf(fd, "\n", NULL);
1052  fclose(fd);
1053 
1054  return 0;
1055 
1056 }
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
int SmoothingF(double *tmp, int npix, int pts)
Smoothing of 1D array.
Definition: FFT.c:151
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ SmoothFloatData()

int SmoothFloatData ( float *  source,
float *  destination,
int  horpix,
int  verpix,
int  filw,
int  bp 
)

Calc. the smoothed matrix of a float one.
.

Parameters
*sourcesource data buffer
*destinationdestination data buffer
horpixhorizontal pixels
verpixvertical pixels
filwfilter windows for smoothing
bpblind pixels

Definition at line 890 of file Save.c.

References IDX, and SmoothingF().

Referenced by BuildLogRatio().

892 {
893 
894  int x, y, n ;
895  FILE *fd;
896  double *avect;
897  unsigned long eln = (unsigned long)(2 * (horpix - bp + 1 )) ;
898 
899  avect = (double *) calloc( eln, sizeof(double));
900  if( avect == NULL )
901  return 1;
902 
903  for(y = 0; y < verpix; y++)
904  {
905  n=1;
906  for(x = 0; x < horpix; x++)
907  {
908  if ((x <= horpix - bp ) & (x > 1))
909  {
910  avect[n] = (double)source[y * (horpix) + x];
911  n++;
912  }
913  }
914 
915  SmoothingF(avect, n - 1, filw);
916 
917  for(x = 0; x < horpix; x++)
918  {
919  if ((x <= horpix - bp ) & (x > 1))
920  {
921  destination[y * horpix + x] = (float) avect[x-1] ;
922  }
923 
924  }
925  }
926 
927  free(avect);
928 
929  fd = fopen("SmoothFL_In.tmp", "w");
930  if(fd < 0) return 1;
931  for(x = 0; x < horpix + 1; x++)
932  {
933  if ((x <= horpix - bp ) & (x > 1))
934  {
935  fprintf(fd, "%04u ", x);
936 
937  for(y = 0; y < verpix; y++)
938  {
939  fprintf(fd, "%10.5lf ", source[y * IDX + x]);
940  }
941  fprintf(fd, "\n", NULL);
942  }
943  }
944  fprintf(fd, "\n", NULL);
945  fclose(fd);
946 
947 
948  fd = fopen("SmoothFL_Out.tmp", "w");
949  if(fd < 0) return 1;
950 
951  for(x = 0; x < horpix + 1; x++)
952  {
953  if ((x <= horpix - bp ) & (x > 1))
954  {
955  fprintf(fd, "%04u ", x);
956 
957  for(y = 0; y < verpix; y++)
958  {
959  fprintf(fd, "%10.5lf ", destination[y * IDX + x]);
960  }
961  fprintf(fd, "\n", NULL);
962  }
963  }
964  fprintf(fd, "\n", NULL);
965  fclose(fd);
966 
967  return 0;
968 }
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
int SmoothingF(double *tmp, int npix, int pts)
Smoothing of 1D array.
Definition: FFT.c:151
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ UPS_Status()

void UPS_Status ( void  )

Definition at line 32 of file Save.c.

Referenced by DB_ToolsKeyB_CB().

33 {
34 
35 
36  SYSTEM_POWER_STATUS status;
37 
38 
39  GetSystemPowerStatus( &status );
40 
41 }
+ Here is the caller graph for this function:

§ WriteColumn()

void WriteColumn ( int  mod,
FILE *  fd 
)

Definition at line 850 of file Save.c.

References paramini::ccdWx, paramini::ccdXoff, D_PrintHMod(), DAS, bil::DPLOT, IDX, IDY, d_view::ImatGraf, doas::lambda, das::Paramini, Pix2Wl(), bil::SPH, and spectrumheader::wavelen.

Referenced by DB_Column().

851 {
852 
853  int x, y;
854 // FILE *fd;
855 // fd = fopen(fname, "a");
856 // if(fd < 0) return 1;
857 // D_VRange("Column FORMAT processing", 0, 128, 254, 128);
858 
859  // Print on file the header
860  D_PrintHMod(fd);
861 
862  if(mod)
864 
865  for(x = 0; x < IDX; x++)
866  {
867 
868  if(mod)
869  fprintf(fd, " %9.4lf", DOAS.lambda[x]);
870  else
871  fprintf(fd, " %04d", x);
872  for(y = 0; y < IDY; y++)
873  {
874  fprintf(fd, " %05u", BIL.DPLOT.ImatGraf[y * IDX + x]);
875  }
876  fprintf(fd, "\n", NULL);
877 // if((x % 40) == 0 && x > 0)
878 // D_VRange(NULL, (long) x * 100 / IDX, 128, 254, 128);
879  }
880  fprintf(fd, "\n", NULL);
881 // fclose(fd);
882 // D_VRange(NULL, 100, 128, 254, 128);
883 // return 0;
884 
885 
886 
887 
888 }
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
int ccdWx
CCD X End.
doas DOAS
Definition: Save.c:27
das DAS
Definition: Chktemp.c:26
int ccdXoff
CCD X Start.
spectrumheader SPH
Spectrum Header Structure.
Definition: bildef.h:256
void D_PrintHMod(FILE *fff)
Print the header in Column format.
Definition: Save.c:790
d_view DPLOT
Definition: bildef.h:254
double lambda[1055]
Wavelength series.
Definition: DOASdef.h:18
bil BIL
Definition: Save.c:26
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
int Pix2Wl(int mod, int pos, int spix, int epix, struct doas *pd)
Definition: DOAS.c:26
unsigned short * ImatGraf
Definition: bildef.h:176
paramini Paramini
structure for the parameters defined in param.ini configuration file
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

§ WriteSelColandSmoothed()

void WriteSelColandSmoothed ( int  mod,
FILE *  fd,
int  selcol 
)

write selected Column

Definition at line 1060 of file Save.c.

References AllocFloatMat(), bil::ANALYSIS, spectrumheader::ccdex, spectrumheader::ccdwx, D_PrintHMod(), DeallocFloatMat(), bil::DPLOT, doas::FFTFilter, IDX, IDY, d_view::ImatOrig, analize::ImatSmooth, doas::lambda, SmoothData(), and bil::SPH.

Referenced by SaveSpectrum().

1061 {
1062 
1063  int x, BlindPix_1;
1064 // FILE *fd;
1065 // fd = fopen(fname, "a");
1066 // if(fd < 0) return 1;
1067 // D_VRange("Column FORMAT processing", 0, 128, 254, 128);
1068 
1069  BlindPix_1 = 0;
1070  if (BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) != 0) // se i pixel del sensore sono piu' di quelli in param.ini
1071  BlindPix_1 = BIL.SPH.ccdwx - (BIL.SPH.ccdex +1) ;
1072 
1074 
1075 
1077 
1078  // Print on file the header
1079  D_PrintHMod(fd);
1080 
1081  for(x = 0; x < IDX - BlindPix_1 + 1; x++)
1082  {
1083 
1084  if(mod)
1085  fprintf(fd, " %9.4lf", DOAS.lambda[x]);
1086  else
1087  fprintf(fd, " %04u", x);
1088 // for(y = selcol; y < IDY; y++)
1089 // {
1090  fprintf(fd, " %05u %9.4lf", BIL.DPLOT.ImatOrig[selcol * IDX + x],BIL.ANALYSIS.ImatSmooth[selcol * IDX + x]);
1091 // }
1092  fprintf(fd, "\n", NULL);
1093 // if((x % 40) == 0 && x > 0)
1094 // D_VRange(NULL, (long) x * 100 / IDX, 128, 254, 128);
1095  }
1096  fprintf(fd, "\n", NULL);
1097 // fclose(fd);
1098 // D_VRange(NULL, 100, 128, 254, 128);
1099 // return 0;
1100 
1102 
1103 
1104 
1105 
1106 }
int IDX
Number of sensible horizontal pixels.
Definition: DAS_Spat.c:118
int SmoothData(unsigned short *source, float *destination, int horpix, int verpix, int filw, int bp)
Calc. the smoothed matrix of an unsigned short one. .
Definition: Save.c:973
doas DOAS
Definition: Save.c:27
analize ANALYSIS
Definition: bildef.h:258
float * DeallocFloatMat(float *mat)
Definition: Spat_Plot.c:153
spectrumheader SPH
Spectrum Header Structure.
Definition: bildef.h:256
float * ImatSmooth
Definition: bildef.h:165
void D_PrintHMod(FILE *fff)
Print the header in Column format.
Definition: Save.c:790
unsigned short * ImatOrig
Definition: bildef.h:180
d_view DPLOT
Definition: bildef.h:254
double lambda[1055]
Wavelength series.
Definition: DOASdef.h:18
bil BIL
Definition: Save.c:26
int IDY
Number of sensible vertical pixels.
Definition: DAS_Spat.c:119
int FFTFilter
Fast Fourier Trasform Filter windows.
Definition: DOASdef.h:25
float * AllocFloatMat(int hp, int vp)
Definition: Spat_Plot.c:2009
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

§ BIL

bil BIL

Definition at line 26 of file Save.c.

§ Cfg

config Cfg

Definition at line 22 of file Save.c.

§ DC_CCD

ccd DC_CCD

Definition at line 20 of file Save.c.

§ DC_HP

ptf DC_HP

Definition at line 21 of file Save.c.

§ DOAS

doas DOAS

Definition at line 27 of file Save.c.

§ FLAG

flag FLAG

flags structure

Definition at line 25 of file Save.c.

§ GRS

GratingSt GRS

Grating.

Definition at line 24 of file Save.c.

§ HDRSP

hdrsp HDRSP

Definition at line 23 of file Save.c.

______________________________________________________________________________________
Generated on Mon Sep 18 2017 11:46:45 for DAS - Rel. 3.1.6 - 18/09/2017.