Grid.lyx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. #LyX 2.1 created this file. For more info see http://www.lyx.org/
  2. \lyxformat 474
  3. \begin_document
  4. \begin_header
  5. \textclass book
  6. \use_default_options true
  7. \master ../../XIOS_user_guide.lyx
  8. \maintain_unincluded_children false
  9. \language english
  10. \language_package default
  11. \inputencoding auto
  12. \fontencoding global
  13. \font_roman default
  14. \font_sans default
  15. \font_typewriter default
  16. \font_math auto
  17. \font_default_family default
  18. \use_non_tex_fonts false
  19. \font_sc false
  20. \font_osf false
  21. \font_sf_scale 100
  22. \font_tt_scale 100
  23. \graphics default
  24. \default_output_format default
  25. \output_sync 0
  26. \bibtex_command default
  27. \index_command default
  28. \float_placement !tph
  29. \paperfontsize default
  30. \spacing single
  31. \use_hyperref false
  32. \papersize a4paper
  33. \use_geometry false
  34. \use_package amsmath 1
  35. \use_package amssymb 1
  36. \use_package cancel 1
  37. \use_package esint 1
  38. \use_package mathdots 1
  39. \use_package mathtools 1
  40. \use_package mhchem 1
  41. \use_package stackrel 1
  42. \use_package stmaryrd 1
  43. \use_package undertilde 1
  44. \cite_engine basic
  45. \cite_engine_type default
  46. \biblio_style plain
  47. \use_bibtopic false
  48. \use_indices false
  49. \paperorientation portrait
  50. \suppress_date false
  51. \justification true
  52. \use_refstyle 1
  53. \index Index
  54. \shortcut idx
  55. \color #008000
  56. \end_index
  57. \secnumdepth 3
  58. \tocdepth 3
  59. \paragraph_separation indent
  60. \paragraph_indentation default
  61. \quotes_language english
  62. \papercolumns 1
  63. \papersides 1
  64. \paperpagestyle default
  65. \tracking_changes false
  66. \output_changes false
  67. \html_math_output 0
  68. \html_css_as_file 0
  69. \html_be_strict false
  70. \end_header
  71. \begin_body
  72. \begin_layout Chapter
  73. Grid
  74. \end_layout
  75. \begin_layout Section
  76. Overview
  77. \end_layout
  78. \begin_layout Standard
  79. Grid plays an important role in XIOS.
  80. Same as Field, Grid is one of the basic elements in XIOS, which should
  81. be well defined, not only in the configuration file but also in the FORTRAN
  82. code.
  83. Because, until now, XIOS has mainly served for writing NetCDF data format,
  84. most of its components are inspired from NetCDF Data Model, and Grid is
  85. not an exception.
  86. Grid is a concept describing dimensions that contain the axes of the data
  87. arrays.
  88. Moreover, Grid always consists of an unlimited dimension whose length can
  89. be expanded at any time.
  90. Other dimensions can be described with Domain and Axis.
  91. The followings describe how to make use of Grid in XIOS.
  92. Details of its attributes and operations can be found in XIOS reference
  93. guide.
  94. \end_layout
  95. \begin_layout Section
  96. Working with configuration file
  97. \end_layout
  98. \begin_layout Standard
  99. As mentioned above, a grid contains the axes of the data arrays, which are
  100. characterized by Domain and/or Axis.
  101. A domain is composed of a 2-dimension array, meanwhile an axis is, as its
  102. name, an 1-dimension array.
  103. \end_layout
  104. \begin_layout Standard
  105. Like other components of XIOS, a grid is defined inside its definition part
  106. with the tag
  107. \series bold
  108. \color black
  109. grid_definition
  110. \series default
  111. \color inherit
  112. \begin_inset listings
  113. lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}"
  114. inline false
  115. status collapsed
  116. \begin_layout Plain Layout
  117. <grid_definition>
  118. \end_layout
  119. \begin_layout Plain Layout
  120. <grid_group id="gridGroup">
  121. \end_layout
  122. \begin_layout Plain Layout
  123. <grid id="grid_A">
  124. \end_layout
  125. \begin_layout Plain Layout
  126. <domain domain_ref="domain_A" />
  127. \end_layout
  128. \begin_layout Plain Layout
  129. <axis axis_ref="axis_C" />
  130. \end_layout
  131. \begin_layout Plain Layout
  132. </grid>
  133. \end_layout
  134. \begin_layout Plain Layout
  135. <grid id="grid_Axis">
  136. \end_layout
  137. \begin_layout Plain Layout
  138. <axis axis_ref="axis_D" />
  139. \end_layout
  140. \begin_layout Plain Layout
  141. </grid>
  142. \end_layout
  143. \begin_layout Plain Layout
  144. <grid id="grid_All_Axis">
  145. \end_layout
  146. \begin_layout Plain Layout
  147. <axis axis_ref="axis_A" />
  148. \end_layout
  149. \begin_layout Plain Layout
  150. <axis axis_ref="axis_B" />
  151. \end_layout
  152. \begin_layout Plain Layout
  153. <axis axis_ref="axis_C" />
  154. \end_layout
  155. \begin_layout Plain Layout
  156. </grid>
  157. \end_layout
  158. \begin_layout Plain Layout
  159. </grid_group>
  160. \end_layout
  161. \begin_layout Plain Layout
  162. </grid_definition>
  163. \end_layout
  164. \end_inset
  165. \end_layout
  166. \begin_layout Standard
  167. As XIOS supports netCDF-4/HDF5, it allows user to gather several grids into
  168. groups to better organize data.
  169. Very often, grids are grouped, basing on the dimensions that they describe.
  170. However, there is not a limit for user to group out the grids.
  171. The more important thing than grid_group is grid.
  172. A grid is defined with the tag
  173. \series bold
  174. \color black
  175. grid.
  176. \end_layout
  177. \begin_layout Standard
  178. While it is not crucial for a grid group not to have an identification specified
  179. by attribute id, a grid must be assigned an id to become useful.
  180. Unlike grid group is a way of hierarchically organizing related grid only,
  181. a grid itself is referenced by fields with its id.
  182. Without the id, a grid can not be made used of by a field.
  183. Id is a string of anything but there is one thing to remember: id of a
  184. grid as well as id of any component in XIOS are
  185. \shape italic
  186. \color black
  187. unique
  188. \shape default
  189. \color inherit
  190. among this kind of components.
  191. It is not allowed to have two grids with a same id, but it is permitted
  192. a grid and, for example, a domain to share a same one.
  193. \end_layout
  194. \begin_layout Standard
  195. A grid is defined by domain(s) and axis.
  196. A domain represents two-dimension data while an axis serves as one-dimension
  197. data.
  198. They are defined inside the grid definition.
  199. One of the convenient and effective way to reuse the definitions in XIOS
  200. is to take advantage of attribute *_ref.
  201. On using *_ref, the referencing component has all attributes from its reference
  202. d one.
  203. As the example below, grid with id
  204. \begin_inset Quotes eld
  205. \end_inset
  206. grid_A
  207. \begin_inset Quotes erd
  208. \end_inset
  209. (from now one, called grid_A), is composed of one domain whose attributes
  210. derived directly from another one-domain_A, and one axis whose attributes
  211. are taken from axis axis_C, which are defined previously.
  212. \end_layout
  213. \begin_layout Standard
  214. \begin_inset listings
  215. lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}"
  216. inline false
  217. status open
  218. \begin_layout Plain Layout
  219. <domain id="domain_A />
  220. \end_layout
  221. \begin_layout Plain Layout
  222. <axis id="axis_A" />
  223. \end_layout
  224. \begin_layout Plain Layout
  225. \end_layout
  226. \begin_layout Plain Layout
  227. <grid id="grid_A">
  228. \end_layout
  229. \begin_layout Plain Layout
  230. <domain domain_ref="domain_A" />
  231. \end_layout
  232. \begin_layout Plain Layout
  233. <axis axis_ref="axis_C" />
  234. \end_layout
  235. \begin_layout Plain Layout
  236. </grid>
  237. \end_layout
  238. \end_inset
  239. \end_layout
  240. \begin_layout Standard
  241. The *_ref can only used to reference to a already defined element (e.g domain,
  242. axis, grid, etc).
  243. If these *_ref have not been defined yet, there will be a runtime error.
  244. \end_layout
  245. \begin_layout Standard
  246. Details about domain and axis can be found in other sections but there is
  247. one thing to bear in mind: A domain represents two-dimension data and it
  248. also contains several special information: longitude, latitude, bound,
  249. etc.
  250. For the meteorological mind, domain indicates a surface with latitude and
  251. longitude, whereas axis represents a vertical level.
  252. \end_layout
  253. \begin_layout Standard
  254. In general cases, there is only a need of writing some multidimensional
  255. data to a netCDF without any specific information, then comes the following
  256. definition of grid.
  257. \end_layout
  258. \begin_layout Standard
  259. \begin_inset listings
  260. lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}"
  261. inline false
  262. status open
  263. \begin_layout Plain Layout
  264. <grid id="grid_All_Axis">
  265. \end_layout
  266. \begin_layout Plain Layout
  267. <axis axis_ref="axis_A" />
  268. \end_layout
  269. \begin_layout Plain Layout
  270. <axis axis_ref="axis_B" />
  271. \end_layout
  272. \begin_layout Plain Layout
  273. <axis axis_ref="axis_C" />
  274. \end_layout
  275. \begin_layout Plain Layout
  276. </grid>
  277. \end_layout
  278. \end_inset
  279. \end_layout
  280. \begin_layout Standard
  281. The grid_All_Axis is similar to grid_A, but with three dimensions defined
  282. by 3 axis that can be described in any way on demand of user.
  283. For example, the axis_A and the axis_B can have corresponding name latitude
  284. and longitude to characterize a two-dimension surface with latitude and
  285. longitude.
  286. \end_layout
  287. \begin_layout Standard
  288. Very often, one dimensional data needs writing to netCDF, it can be easily
  289. done with the following XML code
  290. \end_layout
  291. \begin_layout Standard
  292. \begin_inset listings
  293. lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}"
  294. inline false
  295. status open
  296. \begin_layout Plain Layout
  297. <grid id="grid_Axis">
  298. \end_layout
  299. \begin_layout Plain Layout
  300. <axis axis_ref="axis_D" />
  301. \end_layout
  302. \begin_layout Plain Layout
  303. </grid>
  304. \end_layout
  305. \end_inset
  306. \end_layout
  307. \begin_layout Standard
  308. As it is discussed more details in the next section, but remember that even
  309. the non-distributed one dimensional data can be well processed by XIOS.
  310. \end_layout
  311. \begin_layout Standard
  312. As mentioned above, grid includes by default one unlimited dimension which
  313. is often used as time step axis.
  314. In order to write only time step to netCDF, XIOS provides a special way
  315. to do: empty grid - a grid without any domain or axis.
  316. \end_layout
  317. \begin_layout Standard
  318. \begin_inset listings
  319. lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}"
  320. inline false
  321. status open
  322. \begin_layout Plain Layout
  323. <grid id="grid_TimeStep">
  324. \end_layout
  325. \begin_layout Plain Layout
  326. </grid>
  327. \end_layout
  328. \end_inset
  329. \end_layout
  330. \begin_layout Standard
  331. ∆The order of domain and/or in grid definition decides order of data written
  332. to netCDF: data on domain or axis appearing firstly in grid definition
  333. will vary the most.
  334. For example, on using ncdump command on netCDF which contains data written
  335. on the grid_A .
  336. \end_layout
  337. \begin_layout Standard
  338. \begin_inset listings
  339. lstparams "language=XML,breaklines=true,tabsize=2,frame=tb,postbreak={\raisebox{0ex}[0ex][0ex]{\ensuremath{\rcurvearrowse\space}}}"
  340. inline false
  341. status open
  342. \begin_layout Plain Layout
  343. float field_A(time_counter, axis_A, y, x) ;
  344. \end_layout
  345. \begin_layout Plain Layout
  346. field_A:online_operation = "average" ;
  347. \end_layout
  348. \begin_layout Plain Layout
  349. field_A:interval_operation = "3600s" ;
  350. \end_layout
  351. \begin_layout Plain Layout
  352. field_A:interval_write = "6h" ;
  353. \end_layout
  354. \begin_layout Plain Layout
  355. field_A:coordinates = "time_centered axis_A nav_lat nav_lon" ;
  356. \end_layout
  357. \end_inset
  358. \end_layout
  359. \begin_layout Standard
  360. The data vary most quickly on dimension y, x which are two axes of domain_A.
  361. These are the default name of these dimension of a domain.
  362. The data on axis_C vary slower than on the domain and all the data are
  363. written one time step defined by time_counter at a time.
  364. \end_layout
  365. \begin_layout Standard
  366. Although a grid can be easily configured in XML file, it also needs defining
  367. in the FORTRAN via the definition of domain and axis for a model to work
  368. fully and correctly.
  369. All these instruction will be detailed in the next section.
  370. \end_layout
  371. \begin_layout Section
  372. Working with FORTRAN code
  373. \end_layout
  374. \begin_layout Standard
  375. Because grid is composed of domain and axis, all processing are taken grid
  376. via Domain and Axis.
  377. The next chapters supply the detail of these two sub components.
  378. \end_layout
  379. \end_body
  380. \end_document