CFU (Climate Fortran Utilities)
Several functions of the CFU package are need in the subchain scripts. CFU contains functions that which are not covered neither by neither CDO nor NCO functions .
Expand |
---|
title | add_hours --- add a number of hours to a date |
---|
|
add_hoursPurpose | add a number of hours to a date | Call | cfu add_hours < ystartdate > < hours > [< itype_calendar >]
| Result | YYYYMMDDHH[mmss] | Meanings | ystartdate | has the form YYYYMMDDHH[mmss] | itype_calendar | 0 = 365 days (plus taking into account for leap years) a year |
|
...
1 = climatological calendar (360 days per year) 2 = climatological calendar (365 days per year) |
|
...
Expand |
---|
title | add_lonlat --- adds 2D geographical latitude and longitude to a netCDF file containing rotated coordinates |
---|
|
add_lonlatPurpose | adds 2D geographical latitude and longitude to a netCDF file containing rotated coordinates | Call | cfu add_lonlat < ncfile >
| Result | < ncfile > with two additional 2D fields (lon and lat) | Meanings | ncfile | name of netCDF file to which the coordinates should be added |
|
...
Expand |
---|
title | add_months --- add a number of hours to a date |
---|
|
add_monthsPurpose | add a number of hours to a date | Call | cfu add_months < ystartdate > < months >
| Result | YYYYMMDDHH[mmss] | Meanings | ystartdate | has the form YYYYMMDDHH[mmss] |
|
...
Expand |
---|
title | add_vertices --- adds geographical latitude and longitude vertices to a netCDF file |
---|
|
add_verticesPurpose | adds geographical latitude and longitude vertices to a netCDF file | Call | cfu add_vertices < ncfile >
| Result | < ncfile > with two additional fields (lon_bnds and lat_bnds) with the dimensions (4,lon,lat) | Meanings | ncfile | name of netCDF file to which the vertices should be added | Remark | The counting of the 4 vertices goes like this |
|
...
...
...
...
...
...
Expand |
---|
title | check_files --- check whether all required files in a date range are in a certain directory |
---|
|
check_filesPurpose | check whether all required files in a date range are in a certain directory | Call | cfu check_files < ystartdate > < yenddate > < hh:mm:ss > < prefix12 > < prefix2 > < suffix >< input directory > < last output > [< itype_calendar >]
| Result | 0=success, 1=error. In case of error the file check_files.log contains the names of the missing files. The file check_files.log is written to the directory where the program check_files is called. | Meanings | ystartdate | start date in the form YYYYMMDDHH[mmss] | yenddate | end date the form YYYYMMDDHH[mmss] | hh:mm:ss | time increment of the files in the date range | prefix1 | primary prefix to be checked (e.g. caf, laf, …), i.e. the characters preceding the YYYYMMDDHH[mmss] sequence | prefix2 | secondary prefix to be checked (e.g. cas, lbfd, …), if prefix1 gives errors.In case only one prefix should be checked set prefix1=prefix2 | suffix | suffix to be checked (e.g. .nc, c.nc, …), i.e. the characters following the YYYYMMDDHH[mmss] sequence | input directory | full path to directory holding the files to be checked | last output | should be set to true T in case the yenddate should be included in the check, otherwise it should be set to false F | itype_calendar | 0 = 365 days (plus taking into account for leap years) a year |
|
...
...
climatological calendar (360 days per year) 2 = |
|
...
climatological calendar (365 days per year) |
|
Expand |
---|
title | check_files_iso --- check whether all required files in a date range are in a certain directory |
---|
|
...
(uses ISO time stamp: YYYYMMDDHHTmmssZ) |
|
check_files_iso |
check_files_iso
Purpose | check whether all required files in a date range are in a certain directory (uses ISO time stamp: YYYYMMDDHHTmmssZ) | Call | cfu check_files_iso < ystartdate > < yenddate > < hh:mm:ss > < prefix12 > < prefix2 > < suffix >< input directory > < last output > [< itype_calendar >]
| Result | 0=success, 1=error. In case of error the file check_files.log contains the names of the missing files. The file check_files.log is written to the directory where the program check_files_iso is called. | Meanings | ystartdate | start date in the form YYYYMMDDHHmmss | yenddate | end date the form YYYYMMDDHHmmss | hh:mm:ss | time increment of the files in the date range | prefix1 | primary prefix to be checked (e.g. caf, laf, …), i.e. the characters preceding the YYYYMMDDHH[mmss] sequence | prefix2 | secondary prefix to be checked (e.g. cas, lbfd, …), if prefix1 gives errors.In case only one prefix should be checked set prefix1=prefix2 | suffix | suffix to be checked (e.g. .nc, c.nc, …), i.e. the characters following the YYYYMMDDHHTmmssZ sequence | input directory | full path to directory holding the files to be checked | last output | should be set to true T in case the yenddate should be included in the check, otherwise it should be set to false F | itype_calendar | 0 = 365 days (plus taking into account for leap years) a year |
|
...
...
climatological calendar (360 days per year) 2 = |
|
...
climatological calendar (365 days per year) |
|
...
check whether all required files in a date range are in a certain directory (uses ISO time stamp: YYYYMMDDHHTmmssZ)
Expand |
---|
title | create_rotgrid --- creates lon/lat grid values and lon/lat grid vertices for a rotated g rid |
---|
|
create_ |
...
rotgridPurpose | creates lon/lat grid values and lon/lat grid vertices for a rotated g rid | Call | cfu create_rotgrid <startrlon
|
|
...
...
> <rlon> < drlat> < nrlon |
|
...
>< nrlat > < pollon > < polat > < polgam > < gridfile > | Result | <gridfile> in netCDF format containing the grid information | Meanings | startrlon | longitude of lower left corner in rotated coordinates | startrlat | latitude of lower left corner in rotated coordinates | drlon | longitudinal grid with in rotated coordinates | drlat | latitudinal grid with in rotated coordinates | nrlon | number of grid points in longitudinal direction | nrlat | number of grid points in latitudinal direction | pollon | rotated coordinates of longitude of geographical North Pole | pollat | rotated coordinates of latitude of geographical North Pole | polgam | rotated longitude shift of North Pole | gridfile | output file in netCDF format containing the grid information |
|
...
Expand |
---|
title | get_attval --- get the value of an attribute |
---|
|
get_attvalPurpose | get the value of an attribute | Call | cfu get_attval <ncfile> <varname> <attribute name>
| Result | value of the attribute or -- in case the attribute is not found | Meanings | ncfile | name of the netCDF file | varname | name of the variable with the requested attribute | attribute name | name of the attribute |
|
...
Expand |
---|
title | get_hours --- determine the number of hours between two dates |
---|
|
get_hoursPurpose | determine the number of hours between two dates | Call | cfu get_hours < ystartdate >< enddate > [< itype_calendar >]
| Result | number of hours | Meanings | ystartdate | start date in the |
|
...
form the form YYYYMMDDHH[mmss] | | yenddate | end date in the |
|
...
form the form YYYYMMDDHH[mmss] | | itype_calendar | 0 = 365 days (plus taking into account for leap years) a year |
|
...
1 = climatological calendar (360 days per year) 2 = climatological calendar (365 days per year) |
|
...
Expand |
---|
title | get_next_dates --- determines the next two dates for a given time increment |
---|
|
get_next_datesPurpose | determines the next two dates for a given time increment | Call | cfu get_next_dates < ystartdate >< MM:DD:HH[:mm:ss] > [< itype_calendar >]
| Result | YYYYMMDDHH[mmss]YYYYMMDDHH[mmss] | Meanings | ystartdate | startdate |
|
...
in the form YYYYMMDDHH[mmss] | | MM:DD:HH[:mm:ss] | time increment | | itype_calendar | 0 = 365 days (plus taking into account for leap years) a year |
|
...
1 = climatological calendar (360 days per year) 2 = climatological calendar (365 days per year) | Remark | presently this function is especially for calculating the next dates when running the CCLM in the subchain. This includes a restriction of maximum 28 for DD . Note that the DD restriction only applies for sub monthly chunks. |
|
Expand |
---|
title | get_prev_date --- determines the |
---|
|
...
previous two dates for a given time increment |
|
...
...
get_prev_date
Purpose | determines the previous two dates for a given time increment | Call | cfu get_prev_date < ystartdate >< MM:DD:HH[:mm:ss] > [< itype_calendar >]
| Result | YYYYMMDDHH | Meanings | ystartdate | startdate |
|
...
in the form YYYYMMDDHH[mmss] | | MM:DD:HH[:mm:ss] | time increment | | itype_calendar | 0 = 365 days (plus taking into account for leap years) a year 1 = climatological calendar (360 days per year) 2 = climatological calendar (365 days per year) | Remark | Presently this version takes monthly intervals only. itype_calendar is not used in this version. |
|
...
Expand |
---|
title | icon_domain --- provide helpful input for the ICON Grid Generator + ExtPar Web Frontend |
---|
|
icon_domainPurpose | provide helpful input for |
|
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
39.25000
| Meanings | input file | File that contains the rotated coordinates of the domain to which the ICON results in the post processing script of SPICE will be remapped | | nbound | If only nbound is given as argument: Number of grid points by which the domain given by the input file is extended. This is to keep the rotated domain out of the boundary zone of the regional ICON. If nbound, nudging_zone_width, Rn and Bk are given: Number of extra safety grid points Default: 0 | | nudge_zone_width | The number you are going to use in the namelist interpol_nml settings of your ICON simulations | | Rn and Bk | The n and k values for your chosen ICON grid | Remark | If all parameters are given the number of grid points for the boundaries are calculated as nboundaries = nbound + nudge_zone_width + grf_bdywidth_c where grf_bdywidth_c=4 as described in the ICON Tutorial. The Rn and Bn are used in case the grid width of the rotated grid is smaller than the ICON grid. In this case the number of boundaries are extended to make sure that the boundary width is not too small. |
|
...
Expand |
---|
title | p2sec --- converts ISO 8601 duration in the form PThhHmmMssS into seconds |
---|
|
p2secPurpose | Converts ISO 8601 duration in the form PThhHmmMssS into seconds | Call | cfu p2sec <PThhHmmMssS>
| Result | seconds on standard output | Meanings | PThhHmmMssS | ISO 8601 duration |
|
Expand |
---|
title | shellpp --- "pre-compiles" a shell script |
---|
|
shellppPurpose | "pre-compiles" a shell script | Call | cfu shellpp < input file > < output file > < name > [ <add-on1><,add-on2> ... <,add-onN>]
| Result |
|
...
pre-compiled file output file | Meanings | input file | input file containing the |
|
...
pre-compile commands | | output file | " |
|
...
pre-compiled" output file | | name | name of the |
|
...
"#ifdef name" clauses that should be used | | add-on | names of add-ons to be included | Remark | This is a very rudimentary pre-compiler version like the one for e.g. FORTRAN programs. It can only handle the |
|
...
"pre-compiles" a shell script
...
p2sec
...
Converts ISO 8601 duration in the form PThhHmmMssS into seconds
...
ISO 8601 duration
...
three commands: #ifdef name #else name#endif name |
|
If you are interested in a more sophisticated bash pre-processor please check the one on bashpp GitHub.
Nesting #ifdef are allowed. |
|
Expand |
---|
title | tbtimestamp --- prints the time stamp of the time bounds variable time_bnds |
---|
|
tbtimestampPurpose | Prints the time stamp of the time bounds variable time_bnds | Call | cfu tbtimestamp <input file> [<itype_calendar>]
| Result | YYYY-MM-DDThh:mm:ss as loop over bounds (=2) and time steps | Meanings | input file | File containing the time bounds | | itype_calendar | 0 = 365 days (plus taking into account for leap years) a year |
|
...
1 = climatological calendar (360 days per year) 2 = climatological calendar (365 days per year) |
|
...