Changeset 454 for trunk


Ignore:
Timestamp:
12/09/11 18:08:09 (13 years ago)
Author:
pinsard
Message:

no more zone in amsu t2 files

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/file_amsu_t2_to_mem.pro

    r450 r454  
    55; ======================= 
    66; 
    7 ; .. function:: file_amsu_t2_to_mem(yyyy, mm, dd, numch, lon_min, lon_max, lat_min, lat_max, testfilename) 
     7; .. function:: file_amsu_t2_to_mem(yyyy, mm, dd, numch, testfilename) 
    88; 
    99; DESCRIPTION 
     
    2525; 
    2626; Realistic example with VARAMMA file AMSU-A chanel 5 
    27 ; :file:`${PROJECT_ID}/AMSU/2006/08/a5_20060801_060w30s_050e45n.dat`:: 
     27; :file:`${PROJECT_ID}/AMSU/2006/08/a5_20060801.dat`:: 
    2828; 
    2929;   IDL> numch='a5' 
    30 ;   IDL> yyyy=2006 
     30;   IDL> yyyy=2006L 
    3131;   IDL> mm=8 
    3232;   IDL> dd=1 
    33 ;   IDL> lon_min=-60. 
    34 ;   IDL> lon_max=50. 
    35 ;   IDL> lat_min=-30. 
    36 ;   IDL> lat_max=45. 
    3733;   IDL> testfilename='' 
    38 ;   IDL> result = file_amsu_t2_to_mem(yyyy, mm, dd, numcha, lon_min, lon_max, lat_min, lat_max, testfilename) 
     34;   IDL> result = file_amsu_t2_to_mem(yyyy, mm, dd, numch, testfilename) 
    3935; 
    4036; impression de controle : structure et 1re ligne de données:: 
     
    5551; ==== 
    5652; 
     53; ajouter de # dans les lignes d'entete 
     54; 
    5755; à intégrer dans correct_nadir_amsu.pro 
    5856; 
     
    6866; $URL$ 
    6967; 
     68; - fplod 20111209T150657Z cratos (Linux) 
     69; 
     70;   * suppression des parametres de zone géographique 
     71;   * ajout de nbpix dans la première ligne de header 
     72;   * ajout d'une seconde ligne d'entete avec les coordonnées de la zone 
     73 
    7074; - fplod 20111208T110651Z cratos (Linux) 
    7175; 
     
    8084; - fplod 20111205T094831Z aedon.locean-ipsl.upmc.fr (Darwin) 
    8185; 
    82 ;   * creation : semble ok pour le fichier de test amsub seul 
     86;   * creation thanks to http://www.idlcoyote.com/tips/ascii_column_data.html 
     87; 
     88;     semble ok pour le fichier de test amsub seul 
    8389; 
    8490;- 
    8591FUNCTION file_amsu_t2_to_mem, yyyy, mm, dd, numch $ 
    86                             , lon_min, lon_max, lat_min, lat_max $ 
    8792                            , testfilename 
    8893; 
     
    9499ON_ERROR, 2 
    95100; 
    96 usage = 'result=file_amsu_t2_to_mem(yyyy, mm, dd, numch, lon_min, lon_max, lat_min, lat_max, testfilename)' 
     101usage = 'result=file_amsu_t2_to_mem(yyyy, mm, dd, numch, testfilename)' 
    97102nparam = N_PARAMS() 
    98 IF (nparam NE 9) THEN BEGIN 
     103IF (nparam NE 5) THEN BEGIN 
    99104   ras = report(['Incorrect number of arguments.' $ 
    100105         + '!C' $ 
     
    103108ENDIF 
    104109; 
    105 look = 'filename' 
    106 scale = 1. 
    107 geomin = geolocation_to_string_idl(lon_min, lat_min, look, scale) 
    108 geomax = geolocation_to_string_idl(lon_max, lat_max, look, scale) 
    109110if (testfilename eq '') then begin 
    110111    fullfilename = project_id_env+ 'AMSU/' $ 
     
    114115            + string(yyyy,format='(I4.4)') $ 
    115116            + string(mm,format='(I2.2)') $ 
    116             + string(dd,format='(I2.2)') + '_' $ 
    117             + geomin + '_' $ 
    118             + geomax $ 
     117            + string(dd,format='(I2.2)') $ 
    119118            + '.dat' 
    120119endif else begin 
     
    125124; 
    126125; build header format string 
    127 format_header = '(I4.4,I2.2,I2.2,1X,A)' 
     126format_header1 = '(I4.4,I2.2,I2.2,1X,A2,1X,I3.3)' 
     127format_header2 = '(1x,f8.3,1x,f8.3,1x,f8.3,1x,f8.3)' 
    128128; 
    129129; build data format string 
    130 format_data = '(i1,1x,f8.4,i3,2(1x,f8.3),1x,I1,1x,f8.3)' 
     130format_data = '(i1,1x,f8.4,i3,1x,f8.3,1x,f8.3,1x,I1,1x,f8.3)' 
    131131; 
    132 ; initialize header 
    133 header = STRARR(1) 
    134 ; 
    135 resultheaderstruct = { yyyy : 0L $ 
     132header1= { yyyy : 0L $ 
    136133                    ,  mm : 0L $ 
    137134                    ,  dd : 0L $ 
    138135                    ,  numch : 'X' $ 
     136                    ,  nbpix : 0L $ 
    139137                     } 
    140 resultdatastruct = { desc : 0 $ 
     138header2= { lon_min: 0L $ 
     139                      , lon_max: 0L $ 
     140                      , lat_min: 0L $ 
     141                      , lat_max: 0L $ 
     142                     } 
     143 
     144datastruct = { desc : 0 $ 
    141145                   , hour : 0.0 $ 
    142146                   , fov : 0 $ 
     
    147151                   } 
    148152; 
    149 nrows = file_lines(fullfilename) - N_ELEMENTS(header); 
     153nrows = file_lines(fullfilename) - 2  
    150154; 
    151 resultdata = Replicate(resultdatastruct, nrows) 
    152 result={header: resultheaderstruct, data: resultdata} 
     155data = Replicate(datastruct, nrows) 
    153156; 
    154157; open file 
    155158OPENR, lun, fullfilename, /GET_LUN 
    156 ;++ hanlde error 
     159;++ handle error 
    157160; 
    158161help, result,/structure 
     162help, header1,/structure 
    159163; read header lines 
    160 READF, lun, result.header, format=format_header 
     164READF, lun, header1, format=format_header1 
     165print, header1 
     166READF, lun, header2, format=format_header2 
     167; 
     168print, header2 
    161169; read data lines 
    162 READF, lun, result.data, format=format_data 
     170READF, lun, data, format=format_data 
    163171; 
    164172; close file 
    165173FREE_LUN, lun 
    166174; 
     175result={header1: header1, header2: header2, data: data} 
    167176return, result 
    168177; 
  • trunk/src/mem_to_file_amsu_t2.pro

    r451 r454  
    2525; 
    2626;   IDL> numch='a5' 
    27 ;   IDL> yyyy=2006 
     27;   IDL> yyyy=2006L 
    2828;   IDL> mm=8 
    2929;   IDL> dd=1 
     
    3333;   IDL> lat_max=45. 
    3434;   IDL> testfilename='' 
    35 ;   IDL> amsu_t2 = file_amsu_t2_to_mem(yyyy, mm, dd, numch, lon_min, lon_max, lat_min, lat_max, testfilename) 
     35;   IDL> amsu_t2 = file_amsu_t2_to_mem(yyyy, mm, dd, numch, testfilename) 
    3636;   IDL> testfilename='./a' 
    37 ;   IDL> result = mem_to_file_amsu_t2(yyyy, mm, dd, numch, lon_min, lon_max, lat_min, lat_max, amsu_t2, testfilename) 
     37;   IDL> result = mem_to_file_amsu_t2(amsu_t2, testfilename) 
    3838; 
    3939; look for differences:: 
     
    4848; :func:`file_amsu_t2_to_mem` 
    4949; 
    50 ; use :func:`geolocation_to_string_idl` 
    51 ; 
    5250; TODO 
    5351; ==== 
     52; 
     53; ajouter de # dans les lignes d'entete 
    5454; 
    5555; crier sur valeur manquante de tb 
    5656; 
    5757; à intégrer dans :ref:`extract_amsua.pro` 
    58 ; 
    59 ; suppress other parameter than amsu_t2 : doublons !! pas sur lat_min, etc, 
    60 ; est-ce qu'on es ajoute dans le header ? 
    6158; 
    6259; check args 
     
    7168; $URL$ 
    7269; 
     70; - fplod 20111209T150209Z cratos (Linux) 
     71; 
     72;   * ajout de nbpix dans la première ligne de header 
     73;   * ajout d'une seconde ligne d'entete avec les coordonnées de la zone 
     74;   * suppression de parametres redondants 
     75; 
    7376; - fplod 20111208T173432Z aedon.locean-ipsl.upmc.fr (Darwin) 
    7477; 
     
    8285; - fplod 20111206T163330Z cratos (Linux) 
    8386; 
    84 ;   * creation 
     87;   * creation thanks to http://www.idlcoyote.com/tips/ascii_column_data.html 
    8588; 
    8689;- 
    87 FUNCTION mem_to_file_amsu_t2, yyyy, mm, dd, numch $ 
    88                             , lon_min, lon_max, lat_min, lat_max $ 
    89                             , amsu_t2 $ 
     90FUNCTION mem_to_file_amsu_t2, amsu_t2 $ 
    9091                            , testfilename 
    9192; 
     
    99100result = -1 
    100101; 
    101 usage = 'result=mem_to_file_amsu_t2(yyyy, mm, dd, numch, lon_min, lon_max, lat_min, lat_max, amsu_t2, testfilename)' 
     102usage = 'result=mem_to_file_amsu_t2(amsu_t2, testfilename)' 
    102103nparam = N_PARAMS() 
    103 IF (nparam NE 10) THEN BEGIN 
     104IF (nparam NE 2) THEN BEGIN 
    104105   ras = report(['Incorrect number of arguments.' $ 
    105106         + '!C' $ 
     
    109110; 
    110111if (testfilename eq '') then begin 
    111     look = 'filename' 
    112     scale = 1. 
    113     geomin = geolocation_to_string_idl(lon_min, lat_min, look, scale) 
    114     geomax = geolocation_to_string_idl(lon_max, lat_max, look, scale) 
    115112    fullfilename = project_id_env+ 'AMSU/' $ 
    116113            + string(yyyy,format='(I4.4)') + '/' $ 
     
    119116            + string(yyyy,format='(I4.4)') $ 
    120117            + string(mm,format='(I2.2)') $ 
    121             + string(dd,format='(I2.2)') + '_' $ 
    122             + geomin + '_' $ 
    123             + geomax $ 
     118            + string(dd,format='(I2.2)') $ 
    124119            + '.dat' 
    125120endif else begin 
     
    130125; 
    131126; build header format string 
    132 format_header = '(I4.4,I2.2,I2.2,1X,A)' 
    133 ; 
     127format_header1 = '(I4.4,I2.2,I2.2,1X,A2,1X,I3.3)' 
     128format_header2 = '(1x,f8.3,1x,f8.3,1x,f8.3,1x,f8.3)' 
     129 
    134130; build data format string 
    135 format_data = '(i1,1x,f8.4,i3,2(1x,f8.3),1x,I1,1x,f8.3)' 
     131format_data = '(i1,1x,f8.4,i3,1x,f8.3,1x,f8.3,1x,I1,1x,f8.3)' 
    136132; 
    137133nrows = n_elements(amsu_t2.data) 
     
    142138; 
    143139; write header lines 
    144 PRINTF, lun, amsu_t2.header, format=format_header 
     140header1=amsu_t2.header1 
     141PRINTF, lun, header1, format=format_header1 
     142header2=amsu_t2.header2 
     143PRINTF, lun, header2, format=format_header2 
    145144; 
    146145; write data lines 
    147146for irow=0, nrows -1 do begin 
    148     PRINTF, lun, amsu_t2.data[irow], format=format_data 
     147    data=amsu_t2.data[irow] 
     148    PRINTF, lun, data, format=format_data 
    149149endfor 
    150150; 
Note: See TracChangeset for help on using the changeset viewer.