[260] | 1 | # Whole text at `http://www.lmd.jussieu.fr/~lflmd/ASCIIobs_nc/index.html' |
---|
| 2 | |
---|
| 3 | I developed a kind of all-purpouse python tool to trasnform ASCII column-based data to netcDF. |
---|
| 4 | |
---|
| 5 | It works 'quite' easily: |
---|
| 6 | The python script is called as: |
---|
| 7 | python create_OBSnetcdf.py -c [Comchar] -d [DescFile] -e [Endchar] -f [obsFile] -g [debugFlag] -t [CFreftime],[CFunits] -k [obskind] -s [stloc] |
---|
| 8 | [Comchar]: which characters (':', list) can be used as comment inside the observations file |
---|
| 9 | [DescFile]: ASCII file with all the information of the observational data-set |
---|
| 10 | [Endchar]: character of end of column |
---|
| 11 | [obsFile]: observatinoal ASCII file with data in columns |
---|
| 12 | [debugFlag]: boolean flag for debugging |
---|
| 13 | [CFreftime],[CFunits]: reference and time-units to transform the date to CF convention |
---|
| 14 | [obskind]: kind of observation, up to now: |
---|
| 15 | 'multi-points': multiple individual punctual obs (e.g., lightning strikes) |
---|
| 16 | A new variale called 'obsmap' with the number of observations at a grid mesh of 100x100 will be added |
---|
| 17 | 'single-station': single station on a fixed position |
---|
| 18 | 'trajectory': following a trajectory |
---|
| 19 | A new variale called 'obstrj' with the number of observations at a grid mesh of 100x100x100 will be |
---|
| 20 | added |
---|
| 21 | [stloc]: only with [obskind]='single-station', a ',' list of longitude,latitude,height will be used to |
---|
| 22 | add new variables on the netCDF file with the given values ('lon','lat','height') or with 'st' header |
---|
| 23 | if these variables already exist |
---|
| 24 | |
---|
| 25 | Inside the [DescFile] you will find: |
---|
| 26 | institution=Institution who creates the data |
---|
| 27 | department=Department within the institution |
---|
| 28 | scientists=names of the data producers |
---|
| 29 | contact=contact of the data producers |
---|
| 30 | description=description of the observations |
---|
| 31 | acknowledgement=sentence of acknowlegement |
---|
| 32 | comment=comment for the measurements |
---|
| 33 | |
---|
| 34 | MissingValue='|' list of missing values (strings as they are in the ASCII file) within the data |
---|
| 35 | comment=comments |
---|
| 36 | |
---|
| 37 | varN='|' list of variable names |
---|
| 38 | varLN='|' list of long variable names |
---|
| 39 | varU='|' list units of the variables |
---|
| 40 | varBUFR='|' list BUFR code of the variables |
---|
| 41 | varTYPE='|' list of variable types ('D', 'F', 'I', 'I64', 'S') |
---|
| 42 | |
---|
| 43 | NAMElon=name of the variable with the longitude (x position) |
---|
| 44 | NAMElat=name of the variable with the latitude (y position) |
---|
| 45 | NAMEheight=name of the variable with the heights (z position) |
---|
| 46 | NAMEtime=name of the varibale with the time |
---|
| 47 | FMTtime=format of the time (available: as in 'C'[%Y,...], 'CFtime' for already CF-like time) |
---|
| 48 | |
---|
| 49 | * All the values before 'varN' are stored as global attributes |
---|
| 50 | * All the content as 'var[N/LN/U/BUFR/TYPE]' is used to transform the data |
---|
| 51 | * [MissingValue] is used during the transformation of data and then accordingly to the variable type the correspondant '_FillValue' is assigned |
---|
| 52 | * NAME[lon/lat/height/time]: are used as reference for the netCFD file (in this version only 'NAMEtime') |
---|
| 53 | [NAMEtime] is used to compute the CF-time axis. It can be a combination of different columns (see atached files), whereas [FMTtime] will be used to transform the correspondant time. (How ever, python can not deal with the 7th decimal of the microseconds, so anbything smalloer is lost during the conversion. For all the rest I think is fine). For times already in CF-compilant, FMTtime=CFtime |
---|
| 54 | |
---|
| 55 | As always is easier if you see and example (see atached). I called it in this case as: |
---|
| 56 | |
---|
| 57 | python create_OBSnetcdf.py -c '#' -d description.dat -e space -f ATDnet_data_121018.csv -t 19491201000000,seconds -k multi-stations |
---|
| 58 | |
---|
| 59 | Hope it is useful, |
---|
| 60 | |
---|