Changeset 170


Ignore:
Timestamp:
03/20/12 12:03:36 (12 years ago)
Author:
pinsard
Message:

interp_erai_sst is now a function

Location:
trunk
Files:
5 edited
1 moved

Legend:

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

    r167 r170  
    137137 - :func:`interp_erai_dewt` 
    138138 - :func:`interp_erai_lwr` 
    139  - :ref:`interp_erai_sst_1989_2009.pro` 
     139 - :func:`interp_erai_sst` 
    140140 - :func:`interp_erai_t2m` 
    141141 - :ref:`interp_erai_ws_1989_2009.pro` 
  • trunk/docs/docs_dev/source/guides/generate_tropflux.rst

    r167 r170  
    102102 - :func:`interp_erai_dewt` 
    103103 - :func:`interp_erai_lwr` 
    104  - :ref:`interp_erai_sst_1989_2009.pro` 
     104 - :func:`interp_erai_sst` 
    105105 - :func:`interp_erai_msl.pro` 
    106106 - :func:`interp_erai_t2m` 
  • trunk/src/interp_erai_sst.pro

    r166 r170  
    11;+ 
    22; 
    3 ; .. _interp_erai_sst_1989_2009.pro: 
    4 ; 
    5 ; ============================= 
    6 ; interp_erai_sst_1989_2009.pro 
    7 ; ============================= 
     3; 
     4; =================== 
     5; interp_erai_sst.pro 
     6; =================== 
     7; 
     8; .. function:: interp_erai_sst(yyyymmddb,yyyymmdde) 
    89; 
    910; DESCRIPTION 
     
    2526; Interpolated sst 
    2627; is written in 
    27 ; :file:`${PROJECT_OD}/erai_sst_19890101_20091231_oafluxgrid.nc` 
     28; :file:`${PROJECT_OD}/erai_sst_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    2829; if this file not already exists. 
    2930; 
    3031; This output file 
    31 ; :file:`${PROJECT_OD}/erai_sst_19890101_20091231_oafluxgrid.nc` 
     32; :file:`${PROJECT_OD}/erai_sst_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc` 
    3233; must be processed after by 
    3334; :ref:`sst_correction_ncdf.pro`. 
     
    4142;     .. graphviz:: 
    4243; 
    43 ;        digraph interp_erai_sst_1989_2009 { 
     44;        digraph interp_erai_sst { 
    4445; 
    4546;           file_in [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/20c3m_erai_sstk_TROP_1989_2009.nc"]; 
    4647;           mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; 
    47 ;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_sst_19890101_20091231_oafluxgrid.nc"]; 
    48 ; 
    49 ;           interp_erai_sst_1989_2009 [shape=box, 
     48;           file_out [shape=ellipse,fontname=Courier,label="${PROJECT_OD}/erai_sst_{yyyymmdd}_{yyyymmdd}_oafluxgrid.nc"]; 
     49; 
     50;           interp_erai_sst [shape=box, 
    5051;           fontname=Courier, 
    5152;           color=blue, 
    52 ;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_sst_1989_2009.pro", 
    53 ;           label="${PROJECT}/src/interp_erai_sst_1989_2009.pro"]; 
    54 ; 
    55 ;           {file_in mask} -> {interp_erai_sst_1989_2009} -> {file_out} 
     53;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_sst.pro", 
     54;           label="${PROJECT}/src/interp_erai_sst.pro"]; 
     55; 
     56;           {file_in mask} -> {interp_erai_sst} -> {file_out} 
    5657; 
    5758;        } 
     
    6162; 
    6263; :ref:`interpolate_data` 
     64; 
     65; Used by :ref:`tropflux.sh` 
    6366; 
    6467; :ref:`project_profile.sh` 
     
    8184; 
    8285;  IDL> .compile file_interp 
    83 ;  IDL> interp_erai_sst_1989_2009 
     86;  IDL> yyyymmddb = 19890101 
     87;  IDL> yyyymmdde = 20091231 
     88;  IDL> result = interp_erai_sst(yyyymmddb, yyymmdde) 
     89;  IDL> print, result 
     90; 
    8491; 
    8592; TODO 
     
    94101; use real output of :ref:`compute_erai_daily_region_2d.sh`. 
    95102; 
     103; scientific validation (strange look of data with ncview now) 
     104; 
     105; check [yyyymmddb,yyyymmdde] validity 
     106; 
     107; check if [yyyymmddb,yyyymmdde] is included in ERA-I file 
     108; 
     109; what happen if yyyymmdde > 20091231 : need to read an other ERA-I file 
     110; 
     111; add an example with only one month (ie 200001) 
     112; 
    96113; KNOWN ISSUES 
    97114; ============ 
     
    105122; $Id$ 
    106123; 
    107 ; $URL: svn+ssh://pinsard@forge.ipsl.jussieu.fr/ipsl/forge/projets/tropflux/svn/trunk/src/interp_erai_sst_1989_2009.pro $ 
     124; $URL: svn+ssh://pinsard@forge.ipsl.jussieu.fr/ipsl/forge/projets/tropflux/svn/trunk/src/interp_erai_sst.pro $ 
     125; 
     126; - fplod 20120320 
     127; 
     128;   * taking project_overwite into account 
     129;   * try to add compile_opt seems to be incompatible with ncdf_quickwrite 
     130;   * pro -> function 
    108131; 
    109132; - pinsard 2011-08-23T09:09:16Z loholt1.ipsl.polytechnique.fr (Linux) 
     
    136159; 
    137160;- 
    138 pro interp_erai_sst_1989_2009 
     161function interp_erai_sst $ 
     162         , yyyymmddb $ 
     163         , yyyymmdde 
     164; 
     165;++compile_opt idl2, strictarrsubs, logical_predicate 
    139166; 
    140167@cm_4cal 
     
    144171@cm_project 
    145172; 
     173; Return to caller if errors 
     174ON_ERROR, 2 
     175; 
     176result = -1 
     177; 
     178usage = 'result = interp_erai_lwr(yyyymmddb, yyyymmdde) 
     179nparam = N_PARAMS() 
     180IF (nparam NE 2) THEN BEGIN 
     181   ras = report(['Incorrect number of arguments.' $ 
     182   + '!C' $ 
     183   + 'Usage : ' + usage]) 
     184   return, result 
     185ENDIF 
     186; 
    146187; check for input directory 
    147188; 
     
    151192     msg = 'eee : ${PROJECT_ID} is not defined' 
    152193     ras = report(msg) 
    153      STOP 
     194     return, result 
    154195           END 
    155196 ELSE: BEGIN 
     
    165206   msg = 'eee : the directory' + iodirin  + ' is not accessible.' 
    166207   ras = report(msg) 
    167    STOP 
     208   return, result 
    168209ENDIF 
    169210; 
     
    178219   msg = 'eee : the file ' + fullfilename_msk + ' was not found.' 
    179220   ras = report(msg) 
    180    STOP 
     221   return, result 
    181222ENDIF 
    182223; 
     
    191232   msg = 'eee : the file ' + fullfilename + ' was not found.' 
    192233   ras = report(msg) 
    193    STOP 
     234   return, result 
    194235ENDIF 
    195236; 
     
    199240         msg = 'eee : ${PROJECT_OD} is not defined' 
    200241         ras = report(msg) 
    201        STOP 
     242       return, result 
    202243       END 
    203244  ELSE: BEGIN 
     
    214255    msg = 'eee : the directory' + iodirout  + ' was not found.' 
    215256    ras = report(msg) 
    216     STOP 
     257    return, result 
    217258ENDIF 
    218259; 
    219260; build output filename 
    220 filename_out = 'erai_sst_19890101_20091231_oafluxgrid.nc' 
     261filename_out = 'erai_sst_' + string(yyyymmddb,format='(I8.8)') + '_' + string(yyyymmdde,format='(I8.8)') + '_oafluxgrid.nc' 
    221262fullfilename_out = iodirout + filename_out 
    222263; in order to avoid unexpected overwritten 
    223 IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN 
     264IF ((FILE_TEST(fullfilename_out) EQ 1)  AND (project_overwrite EQ 0)) THEN BEGIN 
    224265   msg = 'eee : the file ' + fullfilename_out  + ' already exists.' 
    225266   ras = report(msg) 
    226    STOP 
     267   return, result 
    227268ENDIF 
    228269; 
    229270initncdf, fullfilename 
    230271domdef 
    231 latin=reform(gphit(0,*)) 
    232 lonin=reform(glamt(*,0)) 
    233 print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) 
    234 print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) 
     272latin=reform(gphit[0,*]) 
     273lonin=reform(glamt[*,0]) 
     274print, 'lat grid ',min(latin),max(latin),latin[1]-latin[0] 
     275print, 'lon grid ',min(lonin),max(lonin),lonin[1]-lonin[0] 
    235276sstkin=read_ncdf("sstk",19871201,20100930,file=fullfilename,/nostr) 
    236277; 
    237278timein=time 
    238279jptin=jpt 
    239 tab=sstkin(*,*,0) 
     280tab=sstkin[*,*,0] 
    240281mskin=glamt*0.+1. 
    241282ind=where((tab eq 1.e9) or finite(tab,/nan)) 
    242 mskin(ind)=0. 
     283mskin[ind]=0. 
    243284; 
    244285initncdf, fullfilename_msk 
    245286domdef 
    246 latout=reform(gphit(0,*)) 
    247 lonout=reform(glamt(*,0)) 
    248 print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) 
    249 print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) 
     287latout=reform(gphit[0,*]) 
     288lonout=reform(glamt[*,0]) 
     289print, 'lat grid ',min(latout),max(latout),latout[1]-latout[0] 
     290print, 'lon grid ',min(lonout),max(lonout),lonout[1]-lonout[0] 
    250291mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) 
    251292; 
     
    255296for jt=0,jptin-1 do begin 
    256297  ; ++print, 'Interpolation jt=',jt,' / ',jptin-1 
    257   tab=reform(sstkin(*,*,jt)) 
    258   sstkout(*,*,jt)=call_interp2d(tab,lonin,latin,mskin $ 
     298  tab=reform(sstkin[*,*,jt]) 
     299  sstkout[*,*,jt]=call_interp2d(tab,lonin,latin,mskin $ 
    259300      , lonout,latout,method='bilinear' $ 
    260301      , OUTMASK_IND=mskout, SET_OUTMSKVAL=mskout) 
    261   sstkout(*,*,jt)=sstkout(*,*,jt)*mskout+(1.-mskout)*1.e20 
     302  sstkout[*,*,jt]=sstkout[*,*,jt]*mskout+(1.-mskout)*1.e20 
    262303endfor 
    263304; 
     
    265306time=timegen(7670, start=julday(1,1,1989,0), units='days') 
    266307jpt=n_elements(time) 
    267 cda0=string(jul2date(time(0)),format='(i8.8)') 
    268 cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 
     308cda0=string(jul2date(time[0]),format='(i8.8)') 
     309cda1=string(jul2date(time[jpt-1]),format='(i8.8)') 
    269310timein=timein-julday(1,1,1950,00,00) 
    270311; 
     
    286327@ncdf_quickwrite 
    287328; 
     329result = 0 
     330return, result 
     331; 
     332 
    288333end 
  • trunk/src/oaflux_mask_30n30s.pro

    r167 r170  
    6565; :func:`interp_erai_dewt`, 
    6666; :func:`interp_erai_lwr`, 
    67 ; :ref:`interp_erai_sst_1989_2009.pro`, 
     67; :func:`interp_erai_sst`, 
    6868; :func:`interp_erai_t2m`, 
    6969; :ref:`interp_erai_ws_1989_2009.pro`, 
  • trunk/src/sst_correction_ncdf.pro

    r100 r170  
    1313; ++ 
    1414; has been produced by 
    15 ; :ref:`interp_erai_sst_1989_2009.pro`. 
     15; :func:`interp_erai_sst`. 
    1616; 
    1717; Corrected sst on OAFLUX grid 
     
    6161; :ref:`mooring_corrections` 
    6262; 
    63 ; :ref:`interp_erai_sst_1989_2009.pro` 
     63; :func:`interp_erai_sst` 
    6464; 
    6565; :func:`initncdf <saxo:initncdf>` 
  • trunk/src/tropflux.sh

    r167 r170  
    9191# :func:`oaflux_mask_30n30s`, :func:`interp_erai_t2m`,  
    9292# :func:`interp_erai_msl`, :func:`interp_erai_dewt`, :func:`interp_erai_lwr`, 
    93 # etc. 
     93# :func:`interp_erai_sst`, etc. 
    9494# 
    9595# Next step : +validation ++ comparison 
     
    112112# 
    113113# $URL$ 
     114# 
     115# - pinsard 20120320 
     116# 
     117#   * handling error of inter_erai_sst (now function) 
    114118# 
    115119# - pinsard 20120319 
     
    317321   exit 
    318322ENDIF 
    319 ;interp_erai_sst_1989_2009 
     323result = interp_erai_sst(${yyyymmddb}, ${yyyymmdde}) 
     324IF result < 0 THEN BEGIN 
     325   msg = 'eee : pb after interp_erai_t2m' + string(result) 
     326   err = report(msg) 
     327   exit 
     328ENDIF 
    320329result = interp_erai_t2m(${yyyymmddb}, ${yyyymmdde}) 
    321330IF result < 0 THEN BEGIN 
Note: See TracChangeset for help on using the changeset viewer.