Changeset 172 for trunk/src


Ignore:
Timestamp:
03/20/12 16:08:01 (12 years ago)
Author:
pinsard
Message:

interp_erai_ws, d2m_to_q2m_erai and interp_olr_30n30s are now functions

Location:
trunk/src
Files:
8 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/TropFlux_19890101_20091231.pro

    r153 r172  
    5959; q2m corrected on OAFLUX grid 
    6060; has been produced by 
    61 ; :ref:`d2m_to_q2m_erai.pro`. 
     61; :func:`d2m_to_q2m_erai`. 
    6262; 
    6363; net heat flux components are written 
  • trunk/src/compute_erai_daily_region_2d.sh

    r167 r172  
    108108# :func:`interp_erai_dewt` 
    109109# :func:`interp_erai_lwr` 
    110 # :ref:`interp_erai_sst_1989_2009.pro` 
     110# :func:`interp_erai_sst` 
    111111# :func:`interp_erai_t2m` 
    112 # :ref:`interp_erai_ws_1989_2009.pro` 
     112# :func:`interp_erai_ws` 
    113113# 
    114114# TODO 
  • trunk/src/d2m_to_q2m_erai.pro

    r167 r172  
    11;+ 
    2 ; 
    3 ; .. _d2m_to_q2m_erai.pro: 
    42; 
    53; =================== 
     
    75; =================== 
    86; 
     7; .. function:: d2m_to_q2m_erai(yyyymmddb,yyyymmdde) 
     8; 
     9; DESCRIPTION 
     10; =========== 
     11; 
    912; Conversion of d2m to q2m on OAFLUX grid 
    1013; 
    11 ; :file:`${PROJECT_OD}/erai_d2m_19890101_20091231_oafluxgrid.nc` 
     14; :file:`${PROJECT_OD}/erai_d2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    1215; containing 
    1316; ++ 
     
    1518; :func:`interp_erai_dewt`. 
    1619; 
    17 ; :file:`${PROJECT_OD}/erai_t2m_19890101_20091231_oafluxgrid.nc` 
     20; :file:`${PROJECT_OD}/erai_t2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    1821; containing 
    1922; ++ 
     
    2124; :func:`interp_erai_t2m`. 
    2225; 
    23 ; :file:`${PROJECT_OD}/erai_msl_19890101_20091231_oafluxgrid.nc` 
     26; :file:`${PROJECT_OD}/erai_msl_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    2427; containing 
    2528; ++ 
     
    3033; q2m on OAFLUX grid 
    3134; is written in 
    32 ; :file:`${PROJECT_OD}/erai_q2m_19890101_20091231_oafluxgrid.nc` 
     35; :file:`${PROJECT_OD}/erai_q2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    3336; if this file not already exists. 
    3437; 
    3538; This file 
    36 ; :file:`${PROJECT_OD}/erai_q2m_19890101_20091231_oafluxgrid.nc` 
     39; :file:`${PROJECT_OD}/erai_q2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    3740; will be used by 
    3841; :ref:`q2m_correction_ncdf.pro`. 
     
    4851;        digraph d2m_to_q2m_erai { 
    4952; 
    50 ;           file_d2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_d2m_19890101_20091231_oafluxgrid.nc"]; 
    51 ;           file_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_t2m_19890101_20091231_oafluxgrid.nc"]; 
    52 ;           file_msl [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_msl_19890101_20091231_oafluxgrid.nc"]; 
    53 ;           file_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_q2m_19890101_20091231_oafluxgrid.nc"]; 
     53;           file_d2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_d2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 
     54;           file_t2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_t2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 
     55;           file_msl [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_msl_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 
     56;           file_q2m [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_q2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 
    5457; 
    5558;           d2m_to_q2m_erai [shape=box, 
     
    7275; [AOMIP]_ 
    7376; 
     77; Used by :ref:`tropflux.sh` 
     78; 
    7479; :ref:`project_profile.sh` 
    7580; 
     
    9196; :: 
    9297; 
    93 ;  IDL> d2m_to_q2m_erai 
     98;  IDL> yyyymmddb = 19890101 
     99;  IDL> yyyymmdde = 20091231 
     100;  IDL> result = d2m_to_q2m_erai(yyyymmddb, yyyymmdde) 
     101;  IDL> print, result 
    94102; 
    95103; TODO 
    96104; ==== 
     105; 
     106; compare time between d2m and t2m after reading 
    97107; 
    98108; pb on cratos idl7 even if output file is written:: 
     
    118128; $URL$ 
    119129; 
     130; - fplod 20120320 
     131; 
     132;   * try to add compile_opt seems to be incompatible with ncdf_quickwrite 
     133;   * pro -> function with yyyymmddb and yyyymmdde parameters 
     134;   * hard coded d1 and d2 replaced by yyyymmddb and yyyymmdde parameters 
     135;   * start to homogenize time handling regarding :func:`interp_erai_t2m` 
     136; 
    120137; - fplod 20110811T114932Z aedon.locean-ipsl.upmc.fr (Darwin) 
    121138; 
     
    151168; 
    152169;- 
    153 pro d2m_to_q2m_erai 
     170function d2m_to_q2m_erai $ 
     171         , yyyymmddb $ 
     172         , yyyymmdde 
     173; 
     174compile_opt idl2, strictarrsubs, logical_predicate 
    154175; 
    155176@cm_4cal 
     
    159180@cm_project 
    160181; 
     182; Return to caller if errors 
     183ON_ERROR, 2 
     184; 
     185result = -1 
     186; 
     187usage = 'result = interp_erai_t2m(yyyymmddb, yyyymmdde)' 
     188nparam = N_PARAMS() 
     189IF (nparam NE 2) THEN BEGIN 
     190ras = report(['Incorrect number of arguments.' $ 
     191      + '!C' $ 
     192      + 'Usage : ' + usage]) 
     193      return, result 
     194ENDIF 
     195; 
    161196; test if ${PROJECT_OD} defined 
    162197CASE project_od_env OF 
     
    164199         msg = 'eee : ${PROJECT_OD} is not defined' 
    165200         ras = report(msg) 
    166        STOP 
     201       return, result 
    167202       END 
    168203  ELSE: BEGIN 
     
    179214   msg = 'eee : the directory' + iodirout  + ' is not accessible.' 
    180215   ras = report(msg) 
    181    STOP 
     216   return, result 
    182217ENDIF 
    183218; 
     
    186221    msg = 'eee : the directory' + iodirout  + ' was not found.' 
    187222    ras = report(msg) 
    188     STOP 
    189 ENDIF 
    190 ; 
    191 d1=19881001 
    192 d2=20101231 
     223    return, result 
     224ENDIF 
    193225; 
    194226; build d2m filename 
    195 filename_d2m='erai_d2m_19890101_20091231_oafluxgrid.nc' 
     227filename_d2m='erai_d2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 
    196228; 
    197229; check if this file exists 
     
    202234   msg = 'eee : the file ' + fullfilename_d2m + ' was not found.' 
    203235   ras = report(msg) 
    204    STOP 
     236   return, result 
    205237ENDIF 
    206238; 
    207239; build t2m filename 
    208 filename_t2m='erai_t2m_19890101_20091231_oafluxgrid.nc' 
     240filename_t2m='erai_t2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 
    209241; 
    210242; check if this file exists 
     
    215247   msg = 'eee : the file ' + fullfilename_t2m + ' was not found.' 
    216248   ras = report(msg) 
    217    STOP 
     249   return, result 
    218250ENDIF 
    219251; 
    220252; build msl filename 
    221 filename_msl='erai_msl_19890101_20091231_oafluxgrid.nc' 
     253filename_msl='erai_msl_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 
    222254; 
    223255; check if this file exists 
     
    228260   msg = 'eee : the file ' + fullfilename_msl + ' was not found.' 
    229261   ras = report(msg) 
    230    STOP 
     262   return, result 
    231263ENDIF 
    232264; 
    233265; build output filename 
    234 filename_out = 'erai_q2m_19890101_20091231_oafluxgrid.nc' 
     266filename_out = 'erai_q2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 
    235267fullfilename_out = iodirout + filename_out 
    236268; in order to avoid unexpected overwritten 
     
    238270   msg = 'eee : the file ' + fullfilename_out  + ' already exists.' 
    239271   ras = report(msg) 
    240    STOP 
     272   return, result 
    241273ENDIF 
    242274; 
    243275; reading erai dew point temperature 
    244276initncdf, fullfilename_d2m 
    245 td=read_ncdf("d2m", d1,d2, file=fullfilename_d2m,/nostr) 
     277td=read_ncdf("d2m", yyyymmddb, yyyymmdde, file=fullfilename_d2m,/nostr) 
     278timein=24.d*(time-julday(1,1,1957,0,0,0)) 
     279jpt=n_elements(timein) 
     280da=jul2date(time[0]) 
     281cda0=string(da,format='(i8.8)') 
     282da=jul2date(time[jpt-1]) 
     283cda1=string(da,format='(i8.8)') 
     284print, 'd2m first date ', cda0 
     285print, 'd2m last date ' , cda1 
    246286; 
    247287; reading erai air temperature 
    248288initncdf, fullfilename_t2m 
    249 t=read_ncdf("t2m", d1,d2, file=fullfilename_t2m,/nostr) 
    250 jpt=n_elements(time) 
     289t=read_ncdf("t2m", yyyymmddb, yyymmdde, file=fullfilename_t2m,/nostr) 
     290timein=24.d*(time-julday(1,1,1957,0,0,0)) 
     291jpt=n_elements(timein) 
     292da=jul2date(time[0]) 
     293cda0=string(da,format='(i8.8)') 
     294da=jul2date(time[jpt-1]) 
     295cda1=string(da,format='(i8.8)') 
     296print, 't2m first date ', cda0 
     297print, 't2m last date ' , cda1 
     298 
    251299help, t, td 
    252300; 
     
    265313; 
    266314initncdf, fullfilename_msl 
    267 P=read_ncdf("msl", d1, d2, file=fullfilename_msl,/nostr) 
     315P=read_ncdf("msl", yyyymmddb, yyyymmdde, file=fullfilename_msl,/nostr) 
    268316help, P 
    269317; ++ for debug ftp error 
    270 ; ++print,P(0:1,0,0) 
     318; ++print,P[0:1,0,0] 
    271319; ++stop 
    272320q2m=rh_to_spechum(rh,t,P) 
     
    274322;writing field 
    275323ncfile='!' + fullfilename_out 
    276 time=timegen(7670, start=julday(1,1,1989,0), units='days') 
    277 jpt=n_elements(time) 
    278 cda0=string(jul2date(time(0)),format='(i8.8)') 
    279 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 
    280 ; 
    281 time=time-julday(1,1,1950,00,00,00) 
    282 xlon=reform(glamt(*,0) ) 
    283 ylat=reform(gphit(0,*)) 
     324xlon=reform(glamt[*,0]) 
     325ylat=reform(gphit[0,*]) 
    284326valmask=1.e20 
    285327; 
     
    290332globattr={source:'Surface specific humidity at 2m calculated from dew point temperature',timerange:cda0+' - '+cda1} 
    291333; 
    292 ncfields = 'q2m[longitude,latitude,time]=q2m:q2m_attr; ' $ 
     334ncfields = 'q2m[longitude,latitude,*time]=q2m:q2m_attr; ' $ 
    293335                      + 'longitude[]=xlon:lon_attr; ' $ 
    294336                      + 'latitude[]=ylat:lat_attr; ' $ 
    295                       + 'time[*time]=time:time_attr ' $ 
     337                      + 'time[]=timein:time_attr ' $ 
    296338                      + ' @ globattr' 
    297339; 
    298340@ncdf_quickwrite 
    299341; 
     342result = 0 
     343return, result 
     344; 
    300345end 
  • trunk/src/interp_erai_ws.pro

    r166 r172  
    11;+ 
    22; 
    3 ; .. _interp_erai_ws_1989_2009.pro: 
    4 ; 
    5 ; ============================ 
    6 ; interp_erai_ws_1989_2009.pro 
    7 ; ============================ 
     3; 
     4; ================== 
     5; interp_erai_ws.pro 
     6; ================== 
     7; 
     8; .. function:: interp_erai_ws(yyyymmddb,yyyymmdde) 
    89; 
    910; DESCRIPTION 
     
    2728; containing OAFLUX grid 
    2829; has been produced by 
    29 ; :func:`oaflux_mask_30n30s.pro`. 
     30; :func:`oaflux_mask_30n30s`. 
    3031; 
    3132; Interpolated u10 and v10 are written in 
     
    4647;     .. graphviz:: 
    4748; 
    48 ;        digraph interp_erai_ws_1989_2009 { 
     49;        digraph interp_erai_ws { 
    4950; 
    5051;           file_u10 [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/20c3m_erai_u10_TROP_1989_2009.nc"]; 
     
    5354;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_ws_19890101_20091231_oafluxgrid.nc"]; 
    5455; 
    55 ;           interp_erai_ws_1989_2009 [shape=box, 
     56;           interp_erai_ws [shape=box, 
    5657;           fontname=Courier, 
    5758;           color=blue, 
    58 ;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_ws_1989_2009.pro", 
    59 ;           label="${PROJECT}/src/interp_erai_ws_1989_2009.pro"]; 
    60 ; 
    61 ;           {file_u10 file_v10 mask} -> {interp_erai_ws_1989_2009} -> {file_out} 
     59;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_ws.pro", 
     60;           label="${PROJECT}/src/interp_erai_ws.pro"]; 
     61; 
     62;           {file_u10 file_v10 mask} -> {interp_erai_ws} -> {file_out} 
    6263; 
    6364;        } 
     
    6970; 
    7071; :ref:`project_profile.sh` 
     72; 
     73; Used by :ref:`tropflux.sh` 
    7174; 
    7275; :func:`report <saxo:report>` 
     
    8790; 
    8891;  IDL> .compile file_interp 
    89 ;  IDL> interp_erai_ws_1989_2009 
     92;  IDL> yyyymmddb = 20000101L 
     93;  IDL> yyyymmdde = 20001231L 
     94;  IDL> result = interp_erai_ws(yyyymmddb, yyyymmdde) 
     95;  IDL> print, result 
    9096; 
    9197; TODO 
    9298; ==== 
     99; 
     100; compare time between u10 and v10 after reading 
    93101; 
    94102; make it work : pb on loholt1 idl8 
     
    116124;   Writing fields: 
    117125;   u10[longitude,latitude,time]=u10out:u10_attr; v10[longitude,latitude,time]=v10out:v10_attr; longitude[]=xlon:lon_attr; latitude[]=ylat:lat_attr; tt[*time]=tt:time_attr  @ globattr 
    118 ;   % NCDF_VARPUT: Operation Failed, bad file (6) or variable (0) id ? 
     126;   % NCDF_VARPUT: Operation Failed, bad file (6) or variable [0] id ? 
    119127;                  (NC_ERROR=-31) 
    120128;   % Stop encountered: INTERP_ERAI_WS_1989_2009    1 
     
    126134; coding rules 
    127135; 
     136; check [yyyymmddb,yyyymmdde] validity 
     137; 
     138; check if [yyyymmddb,yyyymmdde] is included in ERA-I file 
     139; 
     140; what happen if yyyymmdde > 20091231 : need to read an other ERA-I file 
     141; 
    128142; KNOWN ISSUES 
    129143; ============ 
     
    137151; $Id$ 
    138152; 
    139 ; $URL: svn+ssh://pinsard@forge.ipsl.jussieu.fr/ipsl/forge/projets/tropflux/svn/trunk/src/interp_erai_ws_1989_2009.pro $ 
     153; $URL: svn+ssh://pinsard@forge.ipsl.jussieu.fr/ipsl/forge/projets/tropflux/svn/trunk/src/interp_erai_ws.pro $ 
     154; 
     155; - fplod 20120320 
     156; 
     157;   * taking project_overwite into account 
     158;   * try to add compile_opt seems to be incompatible with ncdf_quickwrite 
     159;   * pro -> function 
     160;   * hard coded st and en replaced by yyyymmddb and yyyymmdde parameters 
     161;   * start to homogenize time handling regarding :func:`interp_erai_t2m` 
    140162; 
    141163; - fplod 20110830T135212Z cratos (Linux) 
     
    172194; 
    173195;- 
    174 pro interp_erai_ws_1989_2009 
     196function interp_erai_ws $ 
     197         , yyyymmddb $ 
     198         , yyyymmdde 
     199; 
     200;++compile_opt idl2, strictarrsubs, logical_predicate 
     201; 
     202; Return to caller if errors 
     203ON_ERROR, 2 
     204; 
     205result = -1 
     206; 
     207usage = 'result = interp_erai_lwr(yyyymmddb, yyyymmdde)' 
     208nparam = N_PARAMS() 
     209IF (nparam NE 2) THEN BEGIN 
     210ras = report(['Incorrect number of arguments.' $ 
     211      + '!C' $ 
     212      + 'Usage : ' + usage]) 
     213      return, result 
     214ENDIF 
    175215; 
    176216@cm_4cal 
     
    187227     msg = 'eee : ${PROJECT_ID} is not defined' 
    188228     ras = report(msg) 
    189      STOP 
     229     return, result 
    190230           END 
    191231 ELSE: BEGIN 
     
    201241   msg = 'eee : the directory' + iodirin  + ' is not accessible.' 
    202242   ras = report(msg) 
    203    STOP 
     243   return, result 
    204244ENDIF 
    205245; 
     
    214254   msg = 'eee : the file ' + fullfilename_msk + ' was not found.' 
    215255   ras = report(msg) 
    216    STOP 
    217 ENDIF 
    218 ; 
    219 st=19880101 
    220 en=20100930 
     256   return, result 
     257ENDIF 
    221258; 
    222259; build u10 data filename 
     
    230267   msg = 'eee : the file ' + fullfilename + ' was not found.' 
    231268   ras = report(msg) 
    232    STOP 
     269   return, result 
    233270ENDIF 
    234271; 
     
    238275         msg = 'eee : ${PROJECT_OD} is not defined' 
    239276         ras = report(msg) 
    240        STOP 
     277       return, result 
    241278       END 
    242279  ELSE: BEGIN 
     
    253290    msg = 'eee : the directory' + iodirout  + ' was not found.' 
    254291    ras = report(msg) 
    255     STOP 
     292    return, result 
    256293ENDIF 
    257294; 
    258295; build output filename 
    259 filename_out = 'erai_ws_19890101_20091231_oafluxgrid.nc' 
     296filename_out = 'erai_ws_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 
    260297fullfilename_out = iodirout + filename_out 
    261298; in order to avoid unexpected overwritten 
    262 IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN 
     299IF ((FILE_TEST(fullfilename_out) EQ 1)  AND (project_overwrite EQ 0)) THEN BEGIN 
    263300   msg = 'eee : the file ' + fullfilename_out  + ' already exists.' 
    264301   ras = report(msg) 
    265    STOP 
     302   return, result 
    266303ENDIF 
    267304; 
    268305initncdf, fullfilename 
    269 u10in=read_ncdf("u10",st, en,file=fullfilename,/nostr) 
     306u10in=read_ncdf("u10", yyyymmddb - .5d, yyyymmdde, file=fullfilename,/nostr) 
     307; 
     308timein=24.d*(time-julday(1,1,1957,0,0,0))  
     309jpt=n_elements(timein) 
     310da=jul2date(time[0]) 
     311cda0=string(da,format='(i8.8)') 
     312da=jul2date(time[jpt-1])  
     313cda1=string(da,format='(i8.8)') 
     314print, 'u10 first date ', cda0 
     315print, 'u10 last date ' , cda1 
    270316; 
    271317; build v10 data filename 
     
    279325   msg = 'eee : the file ' + fullfilename + ' was not found.' 
    280326   ras = report(msg) 
    281    STOP 
     327   return, result 
    282328ENDIF 
    283329initncdf, fullfilename 
    284 v10in=read_ncdf("v10",st, en,file=fullfilename,/nostr) 
     330v10in=read_ncdf("v10", yyyymmddb - .5d, yyyymmdde, file=fullfilename,/nostr) 
    285331; 
    286332initncdf, fullfilename 
    287333domdef 
    288 latin=reform(gphit(0,*)) 
    289 lonin=reform(glamt(*,0)) 
    290 print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) 
    291 print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) 
    292 ; 
    293 timein=time 
    294 jptin=jpt 
    295 tab=u10in(*,*,0) 
     334latin=reform(gphit[0,*]) 
     335lonin=reform(glamt[*,0]) 
     336print, 'lat grid ',min(latin),max(latin),latin[1]-latin[0] 
     337print, 'lon grid ',min(lonin),max(lonin),lonin[1]-lonin[0] 
     338; 
     339timein=24.d*(time-julday(1,1,1957,0,0,0)) 
     340jptin=n_elements(timein) 
     341da=jul2date(time[0]) 
     342cda0=string(da,format='(i8.8)') 
     343da=jul2date(time[jpt-1]) 
     344cda1=string(da,format='(i8.8)') 
     345print, 'v10 first date ', cda0 
     346print, 'v10 last date ' , cda1 
     347help, v10in 
     348; 
     349tab=u10in[*,*,0] 
    296350mskin=glamt*0.+1. 
    297351; 
    298352initncdf, fullfilename_msk 
    299353domdef 
    300 latout=reform(gphit(0,*)) 
    301 lonout=reform(glamt(*,0)) 
    302 print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) 
    303 print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) 
     354latout=reform(gphit[0,*]) 
     355lonout=reform(glamt[*,0]) 
     356print, 'lat grid ',min(latout),max(latout),latout[1]-latout[0] 
     357print, 'lon grid ',min(lonout),max(lonout),lonout[1]-lonout[0] 
    304358mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) 
    305359; 
     
    311365for jt=0,jptin-1 do begin 
    312366  ; ++print, 'Interpolation jt=',jt,' / ',jptin-1 
    313   tab=reform(u10in(*,*,jt)) 
    314   u10out(*,*,jt)=call_interp2d(tab,lonin,latin,mskin $ 
     367  tab=reform(u10in[*,*,jt]) 
     368  u10out[*,*,jt]=call_interp2d(tab,lonin,latin,mskin $ 
    315369      , lonout,latout,method='bilinear' $ 
    316370      , OUTMASK_IND=mskout, SET_OUTMSKVAL=mskout) 
    317   u10out(*,*,jt)=u10out(*,*,jt)*mskout+(1.-mskout)*1.e20 
    318 ; 
    319   tab=reform(v10in(*,*,jt)) 
    320   v10out(*,*,jt)=call_interp2d(tab,lonin,latin,mskin $ 
     371  u10out[*,*,jt]=u10out[*,*,jt]*mskout+(1.-mskout)*1.e20 
     372; 
     373  tab=reform(v10in[*,*,jt]) 
     374  v10out[*,*,jt]=call_interp2d(tab,lonin,latin,mskin $ 
    321375      , lonout,latout,method='bilinear' $ 
    322376      , OUTMASK_IND=mskout, SET_OUTMSKVAL=mskout) 
    323   v10out(*,*,jt)=v10out(*,*,jt)*mskout+(1.-mskout)*1.e20 
     377  v10out[*,*,jt]=v10out[*,*,jt]*mskout+(1.-mskout)*1.e20 
    324378; 
    325379endfor 
    326380; 
    327 time=timegen(7670, start=julday(1,1,1989,0), units='days') 
    328 jpt=n_elements(time) 
    329 cda0=string(jul2date(time(0)),format='(i8.8)') 
    330 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 
    331 time=time-julday(1,1,1950,00,00,00) 
    332 xlon=reform(glamt(*,0) ) 
    333 ylat=reform(gphit(0,*)) 
     381xlon=reform(glamt[*,0] ) 
     382ylat=reform(gphit[0,*]) 
    334383; 
    335384initncdf, fullfilename_msk 
     
    346395v10_attr={units:'m/s',missing_value:valmask,long_name:'10 metre v wind component',short_name:'v10',axis:'TYX'} 
    347396; 
    348 help, u10out,v10out,time,xlon,ylat 
    349 ; 
    350 ncfields = 'u10[longitude,latitude,time]=u10out:u10_attr; ' $ 
    351           +'v10[longitude,latitude,time]=v10out:v10_attr; ' $ 
     397help, u10out 
     398help, v10out 
     399help, timein 
     400; 
     401ncfields = 'u10[longitude,latitude,*time]=u10out:u10_attr; ' $ 
     402          +'v10[longitude,latitude,*time]=v10out:v10_attr; ' $ 
    352403                      + 'longitude[]=xlon:lon_attr; ' $ 
    353404                      + 'latitude[]=ylat:lat_attr; ' $ 
    354                       + 'time[*time]=time:time_attr ' $ 
     405                      + 'time[]=timein:time_attr ' $ 
    355406                      + ' @ globattr' 
    356407; 
    357408@ncdf_quickwrite 
    358409; 
     410result = 0 
     411return, result 
     412; 
    359413end 
  • trunk/src/interp_olr_30n30s.pro

    r166 r172  
    11;+ 
    22; 
    3 ; .. _interp_olr_30n30s_1989_2009.pro: 
    4 ; 
    5 ; =============================== 
    6 ; interp_olr_30n30s_1989_2009.pro 
    7 ; =============================== 
     3; ===================== 
     4; interp_olr_30n30s.pro 
     5; ===================== 
     6; 
     7; .. function:: interp_olr_30n30s(yyyymmddb,yyyymmdde) 
    88; 
    99; DESCRIPTION 
     
    2121; 
    2222; Interpolated OLR is written in 
    23 ; :file:`${PROJECT_OD}/${PROJECT_OD}/olr_oafluxgrid_30n30s_19890101_20091231.nc` 
     23; :file:`${PROJECT_OD}/${PROJECT_OD}/olr_oafluxgrid_30n30s_{yyyymmdd}_{yyyymmdd}.nc` 
    2424; if this file not already exists. 
    2525; 
     
    2929;     .. graphviz:: 
    3030; 
    31 ;        digraph interp_olr_30n30s_1989_2009{ 
     31;        digraph interp_olr_30n30s{ 
    3232; 
    3333;           file_in [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/olr.day.mean_new.nc"]; 
    3434;           mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; 
    35 ;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/olr_oafluxgrid_30n30s_19890101_20091231.nc"]; 
    36 ; 
    37 ;           interp_olr_30n30s_1989_2009 [shape=box, 
     35;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/olr_oafluxgrid_30n30s_{yyyymmdd}_{yyyymmdd}.nc"]; 
     36; 
     37;           interp_olr_30n30s [shape=box, 
    3838;           fontname=Courier, 
    3939;           color=blue, 
    40 ;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_olr_30n30s_1989_2009.pro", 
    41 ;           label="${PROJECT}/src/interp_olr_30n30s_1989_2009.pro"]; 
    42 ; 
    43 ;           {file_in mask} -> {interp_olr_30n30s_1989_2009} -> {file_out} 
     40;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_olr_30n30s.pro", 
     41;           label="${PROJECT}/src/interp_olr_30n30s.pro"]; 
     42; 
     43;           {file_in mask} -> {interp_olr_30n30s} -> {file_out} 
    4444; 
    4545;        } 
     
    4848; ======== 
    4949; 
     50; :ref:`interpolate_data` 
     51; 
     52; Used by :ref:`tropflux.sh` 
     53; 
    5054; :ref:`project_profile.sh` 
    51 ; 
    52 ; :ref:`interpolate_data` 
    5355; 
    5456; :ref:`data_in_olr`, :ref:`get_olr.sh` 
     
    6971; 
    7072;  IDL> .compile file_interp 
    71 ;  IDL> interp_olr_30n30s_1989_2009 
     73;  IDL> yyyymmddb = 19890101 
     74;  IDL> yyyymmdde = 20091231 
     75;  IDL> result = interp_olr_30n30s(yyyymmddb, yyyymmdde) 
     76;  IDL> print, result 
    7277; 
    7378; TODO 
     
    8085; I think we do not need any zaxis 
    8186; 
    82 ; strange second value (1) in the file produced on cratos idl 7 20110812:: 
     87; strange second value [1] in the file produced on cratos idl 7 20110812:: 
    8388; 
    8489;   $ ncdump $PROJECT_OD/olr_oafluxgrid_30n30s_19890101_20091231.nc 
     
    106111; ========== 
    107112; 
    108 ; $Id: interp_olr_30n30s_1989_2009.pro 88 2011-08-19 15:40:14Z pinsard $ 
     113; $Id: interp_olr_30n30s.pro 88 2011-08-19 15:40:14Z pinsard $ 
    109114; 
    110115; $URL$ 
     116; 
     117; - fplod 20120320 
     118; 
     119;   * taking project_overwite into account 
     120;   * try to add compile_opt seems to be incompatible with ncdf_quickwrite 
     121;   * pro -> function 
    111122; 
    112123; - fplod 20110812T084449Z aedon.locean-ipsl.upmc.fr (Darwin) 
     
    134145; 
    135146;- 
    136 pro interp_olr_30n30s_1989_2009 
     147function interp_olr_30n30s $ 
     148         , yyyymmddb $ 
     149         , yyyymmdde 
     150; 
     151;++compile_opt idl2, strictarrsubs, logical_predicate 
    137152; 
    138153@cm_4cal 
     
    142157@cm_project 
    143158; 
     159; Return to caller if errors 
     160ON_ERROR, 2 
     161; 
     162result = -1 
     163; 
     164usage = 'result = interp_olr_30n30s(yyyymmddb, yyyymmdde)' 
     165nparam = N_PARAMS() 
     166IF (nparam NE 2) THEN BEGIN 
     167   ras = report(['Incorrect number of arguments.' $ 
     168         + '!C' $ 
     169         + 'Usage : ' + usage]) 
     170   return, result 
     171ENDIF 
     172; 
    144173; check for input directory 
    145174; 
     
    149178     msg = 'eee : ${PROJECT_ID} is not defined' 
    150179     ras = report(msg) 
    151      STOP 
     180     return, result 
    152181           END 
    153182 ELSE: BEGIN 
     
    163192   msg = 'eee : the directory' + iodirin  + ' is not accessible.' 
    164193   ras = report(msg) 
    165    STOP 
     194   return, result 
    166195ENDIF 
    167196; 
     
    176205   msg = 'eee : the file ' + fullfilename_msk + ' was not found.' 
    177206   ras = report(msg) 
    178    STOP 
     207   return, result 
    179208ENDIF 
    180209; 
     
    189218   msg = 'eee : the file ' + fullfilename + ' was not found.' 
    190219   ras = report(msg) 
    191    STOP 
     220   return, result 
    192221ENDIF 
    193222; 
     
    197226         msg = 'eee : ${PROJECT_OD} is not defined' 
    198227         ras = report(msg) 
    199        STOP 
     228       return, result 
    200229       END 
    201230  ELSE: BEGIN 
     
    212241    msg = 'eee : the directory' + iodirout  + ' was not found.' 
    213242    ras = report(msg) 
    214     STOP 
     243    return, result 
    215244ENDIF 
    216245; 
    217246; build output filename 
    218 filename_out = 'olr_oafluxgrid_30n30s_19890101_20091231.nc' 
     247filename_out = 'olr_oafluxgrid_30n30s_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') +'.nc' 
    219248fullfilename_out = iodirout + filename_out 
    220249; in order to avoid unexpected overwritten 
    221 IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN 
     250IF ((FILE_TEST(fullfilename_out) EQ 1)  AND (project_overwrite EQ 0)) THEN BEGIN 
    222251   msg = 'eee : the file ' + fullfilename_out  + ' already exists.' 
    223252   ras = report(msg) 
    224    STOP 
     253   return, result 
    225254ENDIF 
    226255; 
    227256initncdf, fullfilename 
    228257domdef 
    229 latin=reform(gphit(0,*)) 
    230 lonin=reform(glamt(*,0)) 
    231 print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) 
    232 print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) 
    233 olrin=read_ncdf("olr",19881231, 20091231, file=fullfilename,/nostr) 
     258latin=reform(gphit[0,*]) 
     259lonin=reform(glamt[*,0]) 
     260print, 'lat grid ',min(latin),max(latin),latin[1]-latin[0] 
     261print, 'lon grid ',min(lonin),max(lonin),lonin[1]-lonin[0] 
     262olrin=read_ncdf("olr",yyyymmddb-.5d,yyyymmdde, file=fullfilename,/nostr) 
    234263; 
    235264timein=time 
     
    239268initncdf, fullfilename_msk 
    240269domdef 
    241 latout=reform(gphit(0,*)) 
    242 lonout=reform(glamt(*,0)) 
    243 print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) 
    244 print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) 
     270latout=reform(gphit[0,*]) 
     271lonout=reform(glamt[*,0]) 
     272print, 'lat grid ',min(latout),max(latout),latout[1]-latout[0] 
     273print, 'lon grid ',min(lonout),max(lonout),lonout[1]-lonout[0] 
    245274mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) 
    246275; 
     
    252281; 
    253282  print, 'Interpolation jt=',jt,' / ',jptin-1 
    254   tab_olr=reform(olrin(*,*,jt)) 
    255 ; 
    256   olrout(*,*,jt)=call_interp2d(tab_olr,lonin,latin,mskin $ 
     283  tab_olr=reform(olrin[*,*,jt]) 
     284; 
     285  olrout[*,*,jt]=call_interp2d(tab_olr,lonin,latin,mskin $ 
    257286      , lonout,latout,method='bilinear'  $ 
    258287      , OUTMASK_IND=mskout, SET_OUTMSKVAL=mskout) 
    259   olrout(*,*,jt)=olrout(*,*,jt)*mskout+(1.-mskout)*1.e20 
     288  olrout[*,*,jt]=olrout[*,*,jt]*mskout+(1.-mskout)*1.e20 
    260289; 
    261290endfor 
     
    280309@ncdf_quickwrite 
    281310; 
     311result = 0 
     312return, result 
     313; 
    282314end 
  • trunk/src/oaflux_mask_30n30s.pro

    r170 r172  
    6767; :func:`interp_erai_sst`, 
    6868; :func:`interp_erai_t2m`, 
    69 ; :ref:`interp_erai_ws_1989_2009.pro`, 
    70 ; :ref:`interp_olr_30n30s_1989_2009.pro` 
     69; :func:`interp_erai_ws`, 
     70; :func:`interp_olr_30n30s` 
    7171; 
    7272; EXAMPLES 
  • trunk/src/q2m_correction_ncdf.pro

    r100 r172  
    1616; ++ 
    1717; has been produced by 
    18 ; :ref:`d2m_to_q2m_erai.pro`. 
     18; :func:`d2m_to_q2m_erai`. 
    1919; 
    2020; Corrected q2m on OAFLUX grid 
     
    5656; :ref:`mooring_corrections` 
    5757; 
    58 ; :ref:`d2m_to_q2m_erai.pro` 
     58; :func:`d2m_to_q2m_erai` 
    5959; 
    6060; :func:`initncdf <saxo:initncdf>` 
  • trunk/src/rh_to_spechum.pro

    r97 r172  
    3333; ======== 
    3434; 
    35 ; called by :ref:`d2m_to_q2m_erai.pro` 
     35; called by :func:`d2m_to_q2m_erai` 
    3636; 
    3737; use :func:`qsat` 
  • trunk/src/tropflux.sh

    r170 r172  
    9191# :func:`oaflux_mask_30n30s`, :func:`interp_erai_t2m`,  
    9292# :func:`interp_erai_msl`, :func:`interp_erai_dewt`, :func:`interp_erai_lwr`, 
    93 # :func:`interp_erai_sst`, etc. 
     93# :func:`interp_erai_sst`, :func:`interp_erai_ws`, :func:`interp_olr_30n30s`,  
     94# :func:`d2m_to_q2m_erai`, 
     95# etc. 
    9496# 
    9597# Next step : +validation ++ comparison 
     
    115117# - pinsard 20120320 
    116118# 
    117 #   * handling error of inter_erai_sst (now function) 
     119#   * handling error of interp_erai_sst (now function) 
     120#   * handling error of interp_erai_ws (now function) 
     121#   * handling error of interp_olr_30n_30s (now function) 
     122#   * handling error of d2m_to_q2m_erai (now function) 
    118123# 
    119124# - pinsard 20120319 
    120125# 
    121126#   * add project_overwrite usage 
    122 #   * handling error of inter_erai_msl (now function) 
    123 #   * handling error of inter_erai_dewt (now function) 
    124 #   * handling error of inter_erai_lwr (now function) 
     127#   * handling error of interp_erai_msl (now function) 
     128#   * handling error of interp_erai_dewt (now function) 
     129#   * handling error of interp_erai_lwr (now function) 
    125130# 
    126131# - pinsard 20120306 
     
    295300; define overwrite status 
    296301; set to 1 to overwrite existing files 
    297 project_overwrite = 0 
     302project_overwrite = 1 
    298303; 
    299304result = oaflux_mask_30n30s() 
     
    333338   exit 
    334339ENDIF 
    335 ;interp_erai_ws_1989_2009 
    336 ;interp_olr_30n30s_1989_2009 
    337 d2m_to_q2m_erai  
     340result = interp_erai_ws(${yyyymmddb}, ${yyyymmdde}) 
     341IF result < 0 THEN BEGIN 
     342   msg = 'eee : pb after interp_erai_t2m' + string(result) 
     343   err = report(msg) 
     344   exit 
     345ENDIF 
     346result = interp_olr_30n30s(${yyyymmddb}, ${yyyymmdde}) 
     347IF result < 0 THEN BEGIN 
     348   msg = 'eee : pb after interp_erai_t2m' + string(result) 
     349   err = report(msg) 
     350   exit 
     351ENDIF 
     352result = d2m_to_q2m_erai(${yyyymmddb}, ${yyyymmdde}) 
     353IF result < 0 THEN BEGIN 
     354   msg = 'eee : pb after interp_erai_t2m' + string(result) 
     355   err = report(msg) 
     356   exit 
     357ENDIF 
    338358;++Program caused arithmetic error: Floating overflow 
    339359;++ Program caused arithmetic error: Floating illegal operand 
  • trunk/src/ws_correction_ncdf.pro

    r100 r172  
    1313; ++ 
    1414; have been produced by 
    15 ; :ref:`interp_erai_ws_1989_2009.pro`. 
     15; :func:`interp_erai_ws`. 
    1616; 
    1717; Corrected ws on OAFLUX grid 
     
    5555; :ref:`mooring_corrections` 
    5656; 
    57 ; :ref:`interp_erai_vs_1989_2009.pro` 
     57; :func:`interp_erai_ws` 
    5858; 
    5959; :func:`initncdf <saxo:initncdf>` 
Note: See TracChangeset for help on using the changeset viewer.