Changeset 166


Ignore:
Timestamp:
03/19/12 18:07:09 (12 years ago)
Author:
pinsard
Message:

interp_erai_dewt is now a function

Location:
trunk
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/docs/docs_dev/source/guides/data_content.rst

    r157 r166  
    135135 - :ref:`TropFlux_19890101_20091231.pro` 
    136136 
    137  - :ref:`interp_erai_dewt_1989_2009.pro` 
     137 - :func:`interp_erai_dewt` 
    138138 - :ref:`interp_erai_lwr_1989_2009.pro` 
    139139 - :ref:`interp_erai_sst_1989_2009.pro` 
  • trunk/docs/docs_dev/source/guides/generate_tropflux.rst

    r165 r166  
    100100 
    101101tools : 
    102  - :ref:`interp_erai_dewt_1989_2009.pro` 
     102 - :func:`interp_erai_dewt` 
    103103 - :ref:`interp_erai_lwr_1989_2009.pro` 
    104104 - :ref:`interp_erai_sst_1989_2009.pro` 
  • trunk/src/d2m_to_q2m_erai.pro

    r165 r166  
    1313; ++ 
    1414; has been produced by 
    15 ; :ref:`interp_erai_dewt_1989_2009.pro`. 
     15; :func:`interp_erai_dewt`. 
    1616; 
    1717; :file:`${PROJECT_OD}/erai_t2m_19890101_20091231_oafluxgrid.nc` 
     
    7474; :ref:`project_profile.sh` 
    7575; 
    76 ; :ref:`interp_erai_dewt_1989_2009.pro` 
     76; :func:`interp_erai_dewt` 
    7777; :func:`interp_erai_msl` 
    7878; :func:`interp_erai_t2m` 
  • trunk/src/interp_erai_dewt.pro

    r164 r166  
    11;+ 
    22; 
    3 ; .. _interp_erai_dewt_1989_2009.pro: 
    4 ; 
    5 ; ============================== 
    6 ; interp_erai_dewt_1989_2009.pro 
    7 ; ============================== 
     3; ==================== 
     4; interp_erai_dewt.pro 
     5; ==================== 
     6; 
     7; .. function:: interp_erai_dewt(yyyymmddb,yyyymmdde) 
    88; 
    99; DESCRIPTION 
     
    2121; containing OAFLUX grid 
    2222; has been produced by 
    23 ; :func:`oaflux_mask_30n30s.pro`. 
     23; :func:`oaflux_mask_30n30s`. 
    2424; 
    2525; Interpolated d2 
    2626; is written in 
    27 ; :file:`${PROJECT_OD}/erai_d2m_19890101_20091231_oafluxgrid.nc` 
     27; :file:`${PROJECT_OD}/erai_d2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    2828; if this file not already exists. 
    2929; 
    3030; This output file 
    31 ; :file:`${PROJECT_OD}/erai_d2m_19890101_20091231_oafluxgrid.nc` 
     31; :file:`${PROJECT_OD}/erai_d2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    3232; must be processed after by 
    3333; :ref:`d2m_to_q2m_erai.pro`. 
     
    4141;     .. graphviz:: 
    4242; 
    43 ;        digraph interp_erai_dewt_1989_2009 { 
     43;        digraph interp_erai_dewt { 
    4444; 
    4545;           file_in [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/20c3m_erai_d2_TROP_1989_2009.nc"]; 
    4646;           mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; 
    47 ;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_d2m_19890101_20091231_oafluxgrid.nc"]; 
    48 ; 
    49 ;           interp_erai_dewt_1989_2009 [shape=box, 
     47;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_d2m_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 
     48; 
     49;           interp_erai_dewt [shape=box, 
    5050;           fontname=Courier, 
    5151;           color=blue, 
    52 ;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_dewt_1989_2009.pro", 
    53 ;           label="${PROJECT}/src/interp_erai_dewt_1989_2009.pro"]; 
    54 ; 
    55 ;           {file_in mask} -> {interp_erai_dewt_1989_2009} -> {file_out} 
     52;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_dewt.pro", 
     53;           label="${PROJECT}/src/interp_erai_dewt.pro"]; 
     54; 
     55;           {file_in mask} -> {interp_erai_dewt} -> {file_out} 
    5656; 
    5757;        } 
     
    6161; 
    6262; :ref:`interpolate_data` 
     63; 
     64; Used by :ref:`tropflux.sh` 
    6365; 
    6466; :ref:`project_profile.sh` 
     
    8183; 
    8284;  IDL> .compile file_interp 
    83 ;  IDL> interp_erai_dewt_1989_2009 
     85;  IDL> yyyymmddb = 19890101 
     86;  IDL> yyyymmdde = 20091231 
     87;  IDL> result = interp_erai_dewt(yyyymmddb, yyymmdde) 
     88;  IDL> print, result 
    8489; 
    8590; TIPS 
     
    8994; 
    9095;   $ ncks -v d2m -d time,0,1 -d latitude,0,1 -d longitude,0,1 \ 
    91 ;     $PROJECT_ID/erai_d2m_19890101_200 1231_oafluxgrid.nc 
     96;     $PROJECT_ID/erai_d2m_19890101_20091231_oafluxgrid.nc 
    9297; 
    9398; TODO 
     
    98103; use real output of :ref:`compute_erai_daily_region_2d.sh`. 
    99104; 
     105; why 19880101,20100930 as dates in read_ncdf. 
     106; now (20120319) should be yyyymmddb and yyymmdde 
     107; 
     108; check [yyyymmddb,yyyymmdde] validity 
     109; 
     110; check if [yyyymmddb,yyyymmdde] is included in ERA-I file 
     111; 
     112; what happen if yyyymmdde > 20091231 : need to read an other ERA-I file 
     113; 
     114; add an example with only one month (ie 200001) 
     115; 
    100116; coding rules 
     117; 
     118; check time values 
    101119; 
    102120; KNOWN ISSUES 
     
    111129; $Id$ 
    112130; 
    113 ; $URL: svn+ssh://pinsard@forge.ipsl.jussieu.fr/ipsl/forge/projets/tropflux/svn/trunk/src/interp_erai_dewt_1989_2009.pro $ 
     131; $URL: svn+ssh://pinsard@forge.ipsl.jussieu.fr/ipsl/forge/projets/tropflux/svn/trunk/src/interp_erai_dewt.pro $ 
     132; 
     133; - fplod 20120319 
     134; 
     135;   * taking project_overwite into account 
     136;   * try to add compile_opt seems to be incompatible with ncdf_quickwrite 
     137;   * pro -> function 
    114138; 
    115139; - pinsard 2011-08-23T09:09:16Z loholt1.ipsl.polytechnique.fr (Linux) 
     
    142166; 
    143167;- 
    144 pro interp_erai_dewt_1989_2009 
     168function interp_erai_dewt $ 
     169         , yyyymmddb $ 
     170         , yyyymmdde 
     171; 
     172;++compile_opt idl2, strictarrsubs, logical_predicate 
    145173; 
    146174@cm_4cal 
     
    150178@cm_project 
    151179; 
     180; Return to caller if errors 
     181ON_ERROR, 2 
     182; 
     183result = -1 
     184; 
     185usage = 'result = interp_erai_t2m(yyyymmddb, yyyymmdde) 
     186nparam = N_PARAMS() 
     187IF (nparam NE 2) THEN BEGIN 
     188   ras = report(['Incorrect number of arguments.' $ 
     189         + '!C' $ 
     190         + 'Usage : ' + usage]) 
     191   return, result 
     192ENDIF 
     193; 
    152194; check for input directory 
    153195; 
     
    157199     msg = 'eee : ${PROJECT_ID} is not defined' 
    158200     ras = report(msg) 
    159      STOP 
     201     return, result 
    160202           END 
    161203 ELSE: BEGIN 
     
    171213   msg = 'eee : the directory' + iodirin  + ' is not accessible.' 
    172214   ras = report(msg) 
    173    STOP 
     215   return, result 
    174216ENDIF 
    175217; 
     
    184226   msg = 'eee : the file ' + fullfilename_msk + ' was not found.' 
    185227   ras = report(msg) 
    186    STOP 
     228   return, result 
    187229ENDIF 
    188230; 
     
    197239   msg = 'eee : the file ' + fullfilename + ' was not found.' 
    198240   ras = report(msg) 
    199    STOP 
     241   return, result 
    200242ENDIF 
    201243; 
     
    205247         msg = 'eee : ${PROJECT_OD} is not defined' 
    206248         ras = report(msg) 
    207        STOP 
     249       return, result 
    208250       END 
    209251  ELSE: BEGIN 
     
    220262    msg = 'eee : the directory' + iodirout  + ' was not found.' 
    221263    ras = report(msg) 
    222     STOP 
     264    return, result 
    223265ENDIF 
    224266; 
    225267; build output filename 
    226 filename_out = 'erai_d2m_19890101_20091231_oafluxgrid.nc' 
     268filename_out = 'erai_d2m_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 
    227269fullfilename_out = iodirout + filename_out 
    228270; in order to avoid unexpected overwritten 
    229 IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN 
     271IF ((FILE_TEST(fullfilename_out) EQ 1)  AND (project_overwrite EQ 0)) THEN BEGIN 
    230272   msg = 'eee : the file ' + fullfilename_out  + ' already exists.' 
    231273   ras = report(msg) 
    232    STOP 
     274   return, result 
    233275ENDIF 
    234276; 
    235277initncdf, fullfilename 
    236278domdef 
    237 latin=reform(gphit(0,*)) 
    238 lonin=reform(glamt(*,0)) 
    239 print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) 
    240 print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) 
     279latin=reform(gphit[0,*]) 
     280lonin=reform(glamt[*,0]) 
     281print, 'lat grid ',min(latin),max(latin),latin[1]-latin[0] 
     282print, 'lon grid ',min(lonin),max(lonin),lonin[1]-lonin[0] 
    241283d2min=read_ncdf("d2",19881201,20101231,file=fullfilename,/nostr) 
    242284; 
    243285jptin=jpt 
    244 tab=d2min(*,*,0) 
     286tab=d2min[*,*,0] 
    245287mskin=glamt*0.+1. 
    246288; 
    247289initncdf, fullfilename_msk 
    248290domdef 
    249 latout=reform(gphit(0,*)) 
    250 lonout=reform(glamt(*,0)) 
    251 print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) 
    252 print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) 
     291latout=reform(gphit[0,*]) 
     292lonout=reform(glamt[*,0]) 
     293print, 'lat grid ',min(latout),max(latout),latout[1]-latout[0] 
     294print, 'lon grid ',min(lonout),max(lonout),lonout[1]-lonout[0] 
    253295mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) 
    254296; 
     
    258300for jt=0,jptin-1 do begin 
    259301  ; ++ print, 'Interpolation jt=',jt,' / ',jptin-1 
    260   tab=reform(d2min(*,*,jt)) 
    261   d2mout(*,*,jt)=call_interp2d(tab,lonin,latin,mskin $ 
     302  tab=reform(d2min[*,*,jt]) 
     303  d2mout[*,*,jt]=call_interp2d(tab,lonin,latin,mskin $ 
    262304      , lonout,latout,method='bilinear' $ 
    263305      , OUTMASK_IND=mskout, SET_OUTMSKVAL=mskout) 
    264   d2mout(*,*,jt)=d2mout(*,*,jt)*mskout+(1.-mskout)*1.e20 
     306  d2mout[*,*,jt]=d2mout[*,*,jt]*mskout+(1.-mskout)*1.e20 
    265307endfor 
    266308; 
     
    269311time=timegen(7670, start=julday(1,1,1989,0), units='days') 
    270312jpt=n_elements(time) 
    271 cda0=string(jul2date(time(0)),format='(i8.8)') 
    272 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 
     313cda0=string(jul2date(time[0]),format='(i8.8)') 
     314cda1=string(jul2date(time[jpt-1]),format='(i8.8)') 
    273315time=time-julday(1,1,1950,00,00) 
    274316; 
     
    290332@ncdf_quickwrite 
    291333; 
     334result = 0 
     335return, result 
     336; 
    292337end 
  • trunk/src/interp_erai_msl.pro

    r165 r166  
    324324@ncdf_quickwrite 
    325325; 
     326result = 0 
     327return, result 
     328; 
    326329end 
  • trunk/src/interp_erai_t2m.pro

    r165 r166  
    9797; ==== 
    9898; 
    99 ; scientific validation (starnge look of data with ncview now) 
     99; scientific validation (strange look of data with ncview now) 
    100100; 
    101101; check [yyyymmddb,yyyymmdde] validity 
     
    105105; what happen if yyyymmdde > 20091231 : need to read an other ERA-I file 
    106106; 
    107 ; add an example with only one month (ie 200912) 
     107; add an example with only one month (ie 200001) 
    108108; 
    109109; make it work : pb on loholt1 idl8 
  • trunk/src/oaflux_mask_30n30s.pro

    r163 r166  
    6363; Following program use :func:`oaflux_mask_30n30s` output: 
    6464; :ref:`TropFlux_19890101_20091231.pro`, 
    65 ; :ref:`interp_erai_dewt_1989_2009.pro`, 
     65; :func:`interp_erai_dewt`, 
    6666; :ref:`interp_erai_lwr_1989_2009.pro`, 
    6767; :ref:`interp_erai_sst_1989_2009.pro`, 
     
    220220 
    221221@ncdf_quickwrite 
    222  
     222; 
    223223result = 0 
    224  
    225224return, result 
     225; 
    226226END 
  • trunk/src/tropflux.sh

    r165 r166  
    9090# Use : 
    9191# :func:`oaflux_mask_30n30s`, :func:`interp_erai_t2m`,  
    92 # :func:`interp_erai_msl`, etc. 
     92# :func:`interp_erai_msl`, :func:`interp_erai_dewt`, etc. 
    9393# 
    9494# Next step : +validation ++ comparison 
     
    116116#   * add project_overwrite usage 
    117117#   * handling error of inter_erai_msl (now function) 
     118#   * handling error of inter_erai_dewt (now function) 
    118119# 
    119120# - pinsard 20120306 
     
    296297   exit 
    297298ENDIF 
    298 ;interp_erai_dewt_1989_2009 
     299result = interp_erai_dewt(${yyyymmddb}, ${yyyymmdde}) 
     300IF result < 0 THEN BEGIN 
     301   msg = 'eee : pb after interp_erai_dewt' + string(result) 
     302   err = report(msg) 
     303   exit 
     304ENDIF 
    299305;interp_erai_lwr_1989_2009 
    300306result = interp_erai_msl(${yyyymmddb}, ${yyyymmdde}) 
Note: See TracChangeset for help on using the changeset viewer.