Changeset 26 for trunk/src


Ignore:
Timestamp:
12/23/10 17:23:57 (13 years ago)
Author:
pinsard
Message:

progess on interpolation tools (to be cont.)

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/compute_erai_daily_region_2d.sh

    r25 r26  
    109109# :func:`ncea <nco:ncea>` 
    110110# :func:`ncflint <nco:ncflint>` 
     111# 
     112# :ref:`interp_erai_dewt_1989_2009.pro` 
     113# :ref:`interp_erai_lwr_1989_2009.pro` 
     114# :ref:`interp_erai_sst_1989_2009.pro` 
     115# :ref:`interp_erai_t2m_1989_2009.pro` 
     116# :ref:`interp_erai_ws_1989_2009.pro` 
    111117# 
    112118# TODO 
  • trunk/src/interp_erai_t2m_1989_2009.pro

    r25 r26  
    33; .. _interp_erai_t2m_1989_2009.pro: 
    44; 
    5 ; ============================= 
    6 ; interp_erai_t2m_1989_2009.pro 
    7 ; ============================= 
    8 ; 
     5; ================================================================================== 
     6; interp_erai_t2m_1989_2009.pro - Interpolation of t2 from ERA-I grid to OAFLUX grid 
     7; ================================================================================== 
     8; 
     9; Interpolation of t2 from ERA-I grid to OAFLUX grid 
     10; 
     11; :file:`${TROPFLUX_ID}/20c3m_erai_t2_TROP_1989_2009.nc` containing t2 from ERA-I have been produced 
     12; by :ref:`compute_erai_daily_region_2d.sh`. 
     13; 
     14; :file:`${TROPFLUX_ID}/mask_oaflux_30N30S.nc` containing OAFLUX grid have been produced by :ref:`oaflux_mask_30N30S.pro`. 
     15; 
     16; Interpolated t2 is written in 
     17; :file:`${TROPFLUX_OD}/erai_t2m_19890101_20091231_oafluxgrid.nc` if this file not already exists. 
    918; 
    1019;     .. graphviz:: 
     
    1726;           mask [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/mask_oaflux_30N30S.nc"]; 
    1827; 
    19 ;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc"]; 
     28;           ncfile [shape=ellipse,fontname=Courier,label="${TROPFLUX_OD}/erai_t2m_19890101_20091231_oafluxgrid.nc"]; 
    2029; 
    2130;           interp_erai_t2m_1989_2009 [shape=box, 
     
    3746; :ref:`tropflux_profile.sh` 
    3847; 
     48; :ref:`compute_erai_daily_region_2d.sh` 
     49; 
     50; :ref:`oaflux_mask_30N30S.pro` 
     51; 
    3952; :func:`report <saxo:report>` 
    4053; :func:`isadirectory <saxo:isadirectory>` 
     
    4255; :func:`initncdf <saxo:initncdf>` 
    4356; :func:`read_ncdf <saxo:read_ncdf>` 
     57; :func:`ncdf_lec <saxo:ncdf_lec>` 
    4458; :func:`domdef <saxo:domdef>` 
    4559; :func:`call_interp2d <saxo:call_interp2d>` 
     
    6074; make it work !! 
    6175; 
    62 ; now (20101222) :  
    63 ;  - /usr/work/incas/fplod/tropflux_d/20c3m_erai_t2_TROP_1989_2009.nc as no time axis variable 
    64 ;  - Value of Julian date is out of allowed range 
    65 ;  - % Array used to subscript array contains out of range subscript: DATAIN 
     76; strange view (lat and lon shift with ncview) : check grid init 
     77; 
     78; remove useless netcdf_read 
     79; 
     80; check time values 
    6681; 
    6782; why use :func:`call_interp2d <saxo:call_interp2d>` : this is an hidden function of SAXO 
    6883; see :func:`file_interp <saxo:file_interp>` 
    6984; 
    70 ; hard coded directory - usage of ${TROPFLUX_ID} 
    71 ; 
    7285; use as input a file produced by compute_erai_daily_region_2d.sh 
    7386; 
    7487; coding rules 
     88; 
     89; hard coded time in module name and in code 
     90; 
     91; why two "initncdf, fullfilename_msk" 
    7592; 
    7693; KNOWN ISSUES 
     
    8299; EVOLUTIONS 
    83100; ========== 
     101; 
     102; - fplod 20101223T130406Z aedon.locean-ipsl.upmc.fr (Darwin) 
     103; 
     104;    * replace /Volumes/PRAVEEN/TropFlux/input_uncor/ by ${TROPFLUX_OD} 
     105;    * complete documentation 
     106;    * get time dimension in data file 
     107;    * replace read_ncdf by ncdf_lec 
     108; 
     109;      usage of timestep keyword in read_ncdf was not efficient because of  memory problem : 
     110;      can not read the whole time range (ok with 7580, not ok with 7591 while need is 7670 
     111;      :: 
     112; 
     113;        % Unable to allocate memory: to make array. 
     114;        Cannot allocate memory 
     115; 
     116; 
     117;      When timestep keyword is not used we can see these messages:: 
     118; 
     119;         /usr/work/incas/fplod/tropflux_d/20c3m_erai_t2_TROP_1989_2009.nc as no time axis variable 
     120;         given by Praveen 
     121; 
     122;         Value of Julian date is out of allowed range 
     123; 
     124;         % Array used to subscript array contains out of range subscript: DATAIN 
     125; 
    84126; 
    85127; - fplod 20101222T163216Z aedon.locean-ipsl.upmc.fr (Darwin) 
     
    154196ENDIF 
    155197; 
     198; test if ${TROPFLUX_OD} defined 
     199tropflux_od_env=GETENV('TROPFLUX_OD') 
     200CASE tropflux_od_env OF 
     201  '' : BEGIN 
     202         msg = 'eee : ${TROPFLUX_OD} is not defined' 
     203         ras = report(msg) 
     204       STOP 
     205       END 
     206  ELSE: BEGIN 
     207          msg = 'iii : ${TROPFLUX_OD} is ' + tropflux_od_env 
     208          ras = report(msg) 
     209        END 
     210 ENDCASE 
     211; 
     212; check if output data will be possible 
     213iodirout = isadirectory(tropflux_od_env) 
     214; 
     215; existence and protection 
     216IF (FILE_TEST(iodirout, /DIRECTORY, /WRITE) EQ 0) THEN BEGIN 
     217    msg = 'eee : the directory' + iodirout  + ' was not found.' 
     218    ras = report(msg) 
     219    STOP 
     220ENDIF 
     221; 
     222; build output filename 
     223filename_out = 'erai_t2m_19890101_20091231_oafluxgrid.nc' 
     224fullfilename_out = iodirout + filename_out 
     225; in order to avoid unexpected overwritten 
     226IF (FILE_TEST(fullfilename_out) EQ 1) THEN BEGIN 
     227   msg = 'eee : the file ' + fullfilename_out  + ' already exists.' 
     228   ras = report(msg) 
     229   STOP 
     230ENDIF 
     231; 
     232; define grid parameters with t2 file 
    156233initncdf, fullfilename_t2 
    157234domdef 
    158235latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0)) 
    159 print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) 
    160 print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) 
    161 t2min=read_ncdf("t2",19880101,20100930,file=fullfilename_t2,/nostr) 
    162  
    163 timein=time & jptin=jpt 
     236print, 'lat grid from data',min(latin),max(latin),latin(1)-latin(0) 
     237print, 'lon grid from data',min(lonin),max(lonin),lonin(1)-lonin(0) 
     238; 
     239; get the number of time step in t2 file 
     240time_in_step=ncdf_lec(fullfilename_t2,var='time') 
     241ntt=n_elements(time_in_step) 
     242print, 'time steps from data ', ntt 
     243print, 'The first 10 time values (variable time_in_step) = ', time_in_step[0:9] 
     244; 
     245; read t2 data 
     246;++ pb memory t2min=read_ncdf("t2",0,ntt-1,/timestep,file=fullfilename_t2,/nostr) 
     247; the following line is here just to prepare replacement of read_ncdf by ncdf_lec 
     248t2min_read_ncdf=read_ncdf("t2",0,10,/timestep,file=fullfilename_t2,/nostr) 
     249help, t2min_read_ncdf 
     250;++print, 'The first 10 time values (variable time) = ', time[0:9] 
     251;++print, 'time steps after read_ncdf (variable jpt) ', jpt 
     252t2min=ncdf_lec(fullfilename_t2,var='t2') 
     253help, t2min 
     254; 
     255timein=time & jptin=ntt 
    164256tab=t2min(*,*,0) 
    165257mskin=glamt*0.+1. 
    166258 
     259; define grid parameters with mask file 
    167260initncdf, fullfilename_msk 
    168261domdef 
    169262latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0)) 
    170 print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) 
    171 print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) 
     263print, 'lat grid from mask ',min(latout),max(latout),latout(1)-latout(0) 
     264print, 'lon grid from mask ',min(lonout),max(lonout),lonout(1)-lonout(0) 
    172265mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) 
    173266 
     
    176269t2mout=fltarr(jpi,jpj,jptin) 
    177270for jt=0,jptin-1 do begin 
    178   print, 'Interpolation jt=',jt,' / ',jptin-1 
    179271  tab=reform(t2min(*,*,jt)) 
    180272  t2mout(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear') 
     
    182274endfor 
    183275 
    184 timein=timein & jptin=jpt 
    185  
    186276initncdf, fullfilename_msk 
    187277help, t2mout 
    188278tt=timein 
    189 time=julday(1,1,1989)+lindgen(7670)+0.5 & jpt=n_elements(time) 
    190 ;cda0=string(jul2date(time(0)),format='(i8.8)') 
     279time=julday(1,1,1989)+lindgen(ntt)+0.5 & jpt=n_elements(time) 
     280help, time 
     281;cda0=string(jul2date(time[0]),format='(i8.8)') 
    191282;cda1=string(jul2date(time(jpt-1)),format='(i8.8)') 
    192 ;cda0=string('19890101') & cda1=string('20091231') 
     283cda0=string('19890101') & cda1=string('20091231') 
    193284 
    194285timein=time-julday(1,1,1950,00,00) 
     
    196287lat=latout 
    197288lon=lonout 
    198 ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc' 
     289ncfile='!' + fullfilename_out 
     290print, 'ncfile ', ncfile 
    199291lon_attr={units:'degrees_east',long_name:'Longitude'} 
    200292lat_attr={units:'degrees_north',long_name:'Latitude'} 
Note: See TracChangeset for help on using the changeset viewer.