Difference between revisions of "Matlab/ForFLEXPART"
(Created page with "<rst> Input routines for FLEXPART data -------------------------------- These matlab routines are currently available for processing FLEXPART output when you start matlab as us...") |
(No difference)
|
Latest revision as of 11:35, 14 September 2011
<rst> Input routines for FLEXPART data
These matlab routines are currently available for processing FLEXPART output when you start matlab as user flexpart on oluf.nilu.no. You can also get a short description on their usage when typing help <function> at the matlab prompt (e.g. "help flex_header").
- 1. flex_test**
``USAGE: flex_test``
This routine is a short demonstration program which will render a set of figures from a polarcat data set. You can `check out the code <FlexTest>`_ to see how things are done or look at the file /nilu2/home/flexpart/matlab/flexpart/flex_test.m.
- 2. flex_header**
``USAGE: [header fail]=flex_header(path to flexpart output)``
- IMPORTANT:** This routine is now deprecated. Use flex_header_V7 or flex_header_V8 to read in different versions of Flexpart output.
This routine reads in the header information contained in the given flexpart output directory. If not successful, header.open==0 will be the only component of the structure header, and fail will be 1. If successful, fail==0 and you can get all header information by typing disp(header) on the prompt.
- 3. flex_read**
``USAGE: [data drydep wetdep fail]=flex_read(header,unit,nest,time)``
This routine reads in data fields for the specified dates.
- IMPORTANT:** This reads in the converted and new version 7 format! If you still have version 6.x data, either `convert it to version 7 <FlexConvert>`_ , or use the (deprecated) routine read_flex_V6.
- header is the object returned from flex_header
- unit is 0, 1, 2, depending if you read in backward concentration files (prefix grid_conc, default), backward mixing ratio files (prefix grid_pptv), or forward run files (prefix grid_time)
- nest is 0 or 1, depending if you are reading in nested data
- dates is an array of indices or a single index of the field header.dates();
- 4. flex_toc**
``USAGE: [toc_data]=flex_toc(header,data)``
This routine calculates the total column concentration for all dates available in the array data
- 5. flex_header_sec**
``USAGE: [header,fail]=flex_header_sec(path)``
This routine will grab the header file existing in the given path, note: path does not include 'header' It returns a header with the dates in matlab format, and with the latp, lonp arrays convenient for plotting follow up with flex_read_sec (see next). NOTE: use this version for working with 'footprint_total' files
- 6. flex_read_sec**
``USAGE: [grid, drydep, wetdep, fail] = flex_read_sec(header,unit,nspec_ret,pspec_ret,age_ret,nest,time_ret)``
- IMPORTANT:** The same functionality is now provided much faster by the routine flex_read_V7 (see below).
EXAMPLE: running as user flexpart: (otherwise, files are in: ~flexpart/matlab/flexpart
>>[h,f]=flex_header_sec('/nilu_wrk7/jfb/EUCAARI/ASP/OUTDATA/ASP_200603/ASP_200603.001'); >>[g d w]=flex_read_sec(h,4,1,1,1,0,1); >>ci=[1 5 7 10 50 75 100 500 750 1000]; % set the contour intervals >>flex_contour(g,ci,h); % calls flex_contour.m routine to produce a plot
- 7. flex_read_V7**
``USAGE: [grid, drydep, wetdep, fail] = flex_read_V7(header,unit,nspec_ret,pspec_ret,age_ret,nest,time_ret,convert)``
This is the currently fastest input routine for flexpart data, using FORTRAN-based input routines. Changes to the previous version is the parameter convert to read in files with/without appended species number, and the option to read in grid_time_total files with unit=5.
%=========================================== % flex_read_V7.m %------------------------------------------- % input % - header object % - optional: data units, (1==conc(default), 2==pptv, 3==time(bkwd) 4==footprint_total, 5==grid_time_total) % species, default=all % pointspecies, default=all % ageclass, default=all % nest (0/1), default=0 % time, default=all % convert (0/1) default=0, does not append species number % output % - data % - dry deposition % - wet deposition % - fail indicator (1=fail, 0=success) %-------------------------------------------
- 8. flex_read_V8**
``USAGE: [grid, drydep, wetdep, fail] = flex_read_V8(header,unit,nspec_ret,pspec_ret,age_ret,nest,time_ret)``
This routine works in principle just as the V7 version. Some more rigorous checking may be required on individual date files.
Forthcoming routines ***
These routines still have to be implemented. So there is currently no support for reading nested FLEXPART output with matlab.
- X. flex_nest_header**
``USAGE: [header fail]=flex_nest_header(path to flexpart output)``
This will return a header object for the nested files. To read nested data, call flex_read with the returned nested header structure.
.. _here: FlexTest
</rst>