;NAME: ; MapWriteWSOdaily ;PURPOSE: ; Write a 2D array to SRF-type file that Xuepu's code will read ;MODIFICATION HISTORY: ; Aug 2001 (tjd, tdunn@ucsd.edu) pro MapWriteWSOdaily,file,array,header_type ;assume the given file name of the type: ; blahblah1978_???_?.dat ;for daily WSO data rows = 73 ;first and last from diff CR cols = 30 if header_type EQ 2 then rows = 72 passed360 = 0 ;flag, we need this because ;we dont always use integer rotations. rows1 = rows - 1 ;code to find out which carrington rotation we are using Stringlength = STRLEN(file) ;CarRotationPos = Stringlength - 12 ;tjd CarRotationPos = Stringlength - 14 LongitudePos = CarRotationPos + 5 CarRot = STRMID(file,CarRotationPos,4) Longit = STRMID(file,LongitudePos, 3) ;open our file, put in some header CLOSE,2 Print, 'CarRot: ', CarRot Print, 'Longit: ', Longit Print, 'file: ' ,file OPENW,2,file if (header_type eq 0) then begin ;leave it blank PRINTF,2, ' ' PRINTF,2, ' ' endif if (header_type eq 1) then begin PRINTF,2, 'Radial Magnetic Field Components at 2.5 solar radii' PRINTF,2, 'Map put together by Nick Arge' endif if (header_type eq 2) then begin PRINTF,2, 'Radial Magnetic Field Components at 15 solar radii' PRINTF,2, 'Map generated by Xuepu Zhaos CSSS Model' endif PRINTF,2, ' ' ;Print, rows degree = Longit ;enter data FOR I=0,(rows1) DO BEGIN if degree EQ 0 then degree = 360 if degree LE 0 then degree = 360 + degree if degree EQ 360 then passed360 = 1 degree = STRTRIM(STRING(degree),2) if (strlen(degree)) EQ 2 THEN degree = '0' + degree if (strlen(degree)) EQ 1 THEN degree = '00' + degree if passed360 EQ 0 then AdjustedCarRot = CarRot -1 if passed360 EQ 1 then AdjustedCarRot = CarRot AdjustedCarRot = STRTRIM(STRING(AdjustedCarRot),2) stuff = "CT" + STRING(AdjustedCarRot) + ":" + degree + " " ; print,'stuff: ',stuff ; ln = strlen(stuff) ; print, 'LN is', ln If (( header_type EQ 1) AND (I EQ 0)) THEN BEGIN stuff = "CT" + STRING(CarRot) + ":" + degree + " " PRINTF,2, FORMAT = '( A18,6F9.3)',stuff,Array(rows1,00),Array(rows1,01),Array(rows1,02),Array(rows1,03),Array(rows1,04),Array(rows1,05) PRINTF,2, FORMAT = '(8F9.3)',Array(rows1,06 ),Array(rows1,07),Array(rows1,08),Array(rows1,09),Array(rows1,10),Array(rows1,11),Array(rows1,12),Array(rows1,13) PRINTF,2, FORMAT = '(8F9.3)',Array(rows1,14),Array(rows1,15),Array(rows1,16),Array(rows1,17),Array(rows1,18),Array(rows1,19),Array(rows1,20),Array(rows1,21) PRINTF,2, FORMAT = '(8F9.3)',Array(rows1,22),Array(rows1,23),Array(rows1,24),Array(rows1,25),Array(rows1,26),Array(rows1,27),Array(rows1,28),Array(rows1,29) ENDIF ELSE BEGIN PRINTF,2, FORMAT = '( A18,6F9.3)',stuff,Array(I,00),Array(I,01),Array(I,02),Array(I,03),Array(I,04),Array(I,05) PRINTF,2, FORMAT = '(8F9.3)',Array(I,06 ),Array(I,07),Array(I,08),Array(I,09),Array(I,10),Array(I,11),Array(I,12),Array(I,13) PRINTF,2, FORMAT = '(8F9.3)',Array(I,14),Array(I,15),Array(I,16),Array(I,17),Array(I,18),Array(I,19),Array(I,20),Array(I,21) PRINTF,2, FORMAT = '(8F9.3)',Array(I,22),Array(I,23),Array(I,24),Array(I,25),Array(I,26),Array(I,27),Array(I,28),Array(I,29) ENDELSE degree = degree - 5 ENDFOR if (header_type eq 2) then begin if degree EQ 0 then degree = 360 if degree LE 0 then degree = 360 + degree degree = STRTRIM(STRING(degree),2) if (strlen(degree)) EQ 2 THEN degree = '0' + degree if (strlen(degree)) EQ 1 THEN degree = '00' + degree stuff = "CT" + STRING(CarRot) + ":" + degree + " " PRINTF,2, FORMAT = '( A18,6F9.3)',stuff,Array(1,00),Array(1,01),Array(1,02),Array(1,03),Array(1,04),Array(1,05) PRINTF,2, FORMAT = '(8F9.3)',Array(1,06 ),Array(1,07),Array(1,08),Array(1,09),Array(1,10),Array(1,11),Array(1,12),Array(1,13) PRINTF,2, FORMAT = '(8F9.3)',Array(1,14),Array(1,15),Array(1,16),Array(1,17),Array(1,18),Array(1,19),Array(1,20),Array(1,21) PRINTF,2, FORMAT = '(8F9.3)',Array(1,22),Array(1,23),Array(1,24),Array(1,25),Array(1,26),Array(1,27),Array(1,28),Array(1,29) endif PRINTF,2, '_______' CLOSE,2 Print, 'mapwritewsodaily - The array is now written to ', file end