Ignore:
Timestamp:
02/18/14 11:03:22 (10 years ago)
Author:
pinsard
Message:

fix thanks to coding rules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/join_dmean_asc.pro

    r8 r13  
    99;    Join information from mean (++details) and asc (++detail) structures 
    1010; 
    11 ;    If station is not found in data_asc structure, latitude and longitude are set 
    12 ;    to NaN. 
     11;    If station is not found in data_asc structure, latitude and longitude 
     12;    are set to NaN. 
    1313; 
    1414;    :param data_dmean: structure ++details 
     
    2525; :examples: 
    2626; 
    27 ; Realistic example with POMME files:: 
     27; Realistic example with POMME files: 
    2828; 
    29 ;    IDL> data_asc=file_asc_to_mem() 
    30 ;    IDL> data_prn=file_prn_to_mem() 
    31 ;    IDL> data_dmean=dmean_mld(data_prn) 
    32 ;    IDL> data_insitu=join_dmean_asc(data_dmean,data_asc) 
     29; .. code-block:: idl 
    3330; 
    34 ; impression de controle :: 
     31;    data_asc = file_asc_to_mem() 
     32;    data_prn = file_prn_to_mem() 
     33;    data_dmean = dmean_mld(data_prn) 
     34;    data_insitu = join_dmean_asc(data_dmean,data_asc) 
    3535; 
    36 ;    IDL> help, data_insitu, /structure 
    37 ;    IDL> print, data_insitu[0] 
    38 ;    IDL> print, data_insitu.lat 
    39 ;    IDL> print, data_insitu.lon 
     36; impression de controle : 
     37; 
     38; .. code-block:: idl 
     39; 
     40;    help, data_insitu, /structure 
     41;    print, data_insitu[0] 
     42;    print, data_insitu.lat 
     43;    print, data_insitu.lon 
    4044; 
    4145; :uses: 
     
    6367; 
    6468; check doy in prn files vs computed julianday 
    65 ; now (20101124) differences due to either bad calculation here or bad doy calculion in .prn file or difference choice between begin, end, middle time. 
     69; now (20101124) differences due to either bad calculation here or bad 
     70; doy calculion in .prn file or difference choice between begin, end, 
     71; middle time. 
    6672; 
    6773; :history: 
     
    9096;- 
    9197FUNCTION join_dmean_asc, data_dmean, data_asc 
    92 ; 
    93 compile_opt idl2, strictarrsubs 
    94 ; 
    95 ; Return to caller if errors 
    96 ON_ERROR, 2 
    97 ; 
    98 usage = 'result=join_dmean_asc(data_asc,data_dmean)' 
    99 ; 
    100 nparam = N_PARAMS() 
    101 IF (nparam LT 2) THEN BEGIN 
    102    ras = report(['Incorrect number of arguments.' $ 
    103          + '!C' $ 
    104          + 'Usage : ' + usage]) 
    105    return, -1 
    106 ENDIF 
    107 ; 
    108 ; initialize returned structure 
    109 resultstruct = { doy : 0L $ 
    110              , lat: 0.0 $ 
    111              , lon: 0.0 $ 
    112              , mean_zhom001: 0.0 $ 
    113              , mean_zhom002 : 0.0 $ 
    114              , mean_zhom005 : 0.0 $ 
    115              , mean_zhom010: 0.0 $ 
    116              , mean_zhomelch : 0.0 $ 
    117              , std_zhom001: 0.0 $ 
    118              , std_zhom002 : 0.0 $ 
    119              , std_zhom005 : 0.0 $ 
    120              , std_zhom010: 0.0 $ 
    121              , std_zhomelch : 0.0 $ 
    122              } 
    123 ; 
    124 ndays = n_elements(data_dmean) 
    125 result = replicate(resultstruct, ndays) 
    126 ; 
    127 ; fill returned structure 
    128 FOR iday=0L, ndays -1 DO BEGIN 
    129    result[iday].doy=data_dmean[iday].doy 
    130    result[iday].mean_zhom001=data_dmean[iday].mean_zhom001 
    131    result[iday].mean_zhom002=data_dmean[iday].mean_zhom002 
    132    result[iday].mean_zhom005=data_dmean[iday].mean_zhom005 
    133    result[iday].mean_zhom010=data_dmean[iday].mean_zhom010 
    134    result[iday].mean_zhomelch=data_dmean[iday].mean_zhomelch 
    135    result[iday].std_zhom001=data_dmean[iday].std_zhom001 
    136    result[iday].std_zhom002=data_dmean[iday].std_zhom002 
    137    result[iday].std_zhom005=data_dmean[iday].std_zhom005 
    138    result[iday].std_zhom010=data_dmean[iday].std_zhom010 
    139    result[iday].std_zhomelch=data_dmean[iday].std_zhomelch 
    140    indice_asc=WHERE(data_asc.station EQ data_dmean[iday].first_station,count) 
    141    IF (count EQ 0) THEN BEGIN 
    142       print, 'no station ',  data_dmean[iday].first_station,' in data_asc.station' 
    143       result[iday].lat = !VALUES.F_NAN 
    144       result[iday].lon = !VALUES.F_NAN 
    145    ENDIF ELSE BEGIN 
    146       ;print, 'indice de la first_station', data_dmean[iday].first_station,' dans data_asc = ',indice_asc 
    147       result[iday].lat = data_asc[indice_asc[0]].lat 
    148       result[iday].lon = data_asc[indice_asc[0]].lon 
    149    ENDELSE 
    150 ENDFOR 
    151 ; 
    152 return, result 
    153 ; 
     98    ; 
     99    compile_opt idl2, strictarrsubs 
     100    ; 
     101    ; Return to caller if errors 
     102    ON_ERROR, 2 
     103    ; 
     104    usage = 'result = join_dmean_asc(data_asc,data_dmean)' 
     105    ; 
     106    nparam = N_PARAMS() 
     107    IF (nparam LT 2) THEN BEGIN 
     108        ras = report(['Incorrect number of arguments.' $ 
     109        + '!C' $ 
     110        + 'Usage : ' + usage]) 
     111        return, -1 
     112    ENDIF 
     113    ; 
     114    ; initialize returned structure 
     115    resultstruct = { doy : 0L $ 
     116    , lat: 0.0 $ 
     117    , lon: 0.0 $ 
     118    , mean_zhom001: 0.0 $ 
     119    , mean_zhom002 : 0.0 $ 
     120    , mean_zhom005 : 0.0 $ 
     121    , mean_zhom010: 0.0 $ 
     122    , mean_zhomelch : 0.0 $ 
     123    , std_zhom001: 0.0 $ 
     124    , std_zhom002 : 0.0 $ 
     125    , std_zhom005 : 0.0 $ 
     126    , std_zhom010: 0.0 $ 
     127    , std_zhomelch : 0.0 $ 
     128    } 
     129    ; 
     130    ndays = n_elements(data_dmean) 
     131    result = replicate(resultstruct, ndays) 
     132    ; 
     133    ; fill returned structure 
     134    FOR iday = 0L, ndays - 1 DO BEGIN 
     135        result[iday].doy = data_dmean[iday].doy 
     136        result[iday].mean_zhom001 = data_dmean[iday].mean_zhom001 
     137        result[iday].mean_zhom002 = data_dmean[iday].mean_zhom002 
     138        result[iday].mean_zhom005 = data_dmean[iday].mean_zhom005 
     139        result[iday].mean_zhom010 = data_dmean[iday].mean_zhom010 
     140        result[iday].mean_zhomelch = data_dmean[iday].mean_zhomelch 
     141        result[iday].std_zhom001 = data_dmean[iday].std_zhom001 
     142        result[iday].std_zhom002 = data_dmean[iday].std_zhom002 
     143        result[iday].std_zhom005 = data_dmean[iday].std_zhom005 
     144        result[iday].std_zhom010 = data_dmean[iday].std_zhom010 
     145        result[iday].std_zhomelch = data_dmean[iday].std_zhomelch 
     146        indice_asc = WHERE(data_asc.station EQ data_dmean[iday].first_station,count) 
     147        IF (count EQ 0) THEN BEGIN 
     148            print, 'no station ',  data_dmean[iday].first_station,' in data_asc.station' 
     149            result[iday].lat = !VALUES.F_NAN 
     150            result[iday].lon = !VALUES.F_NAN 
     151        ENDIF ELSE BEGIN 
     152            ;print, 'indice de la first_station', data_dmean[iday].first_station,' dans data_asc = ',indice_asc 
     153            result[iday].lat = data_asc[indice_asc[0]].lat 
     154            result[iday].lon = data_asc[indice_asc[0]].lon 
     155        ENDELSE 
     156    ENDFOR 
     157    ; 
     158    return, result 
     159    ; 
    154160END 
Note: See TracChangeset for help on using the changeset viewer.