Grails_教程资料
- 格式:doc
- 大小:253.50 KB
- 文档页数:9
【grads】ncdump的使⽤总结1、参数ncdumpncdump [-c] [-h] [-v var1,...] [-b lang] [-f lang] [-l len] [-n name] [-d f_digits[,d_digits]] fileWhere:-cShow the values of coordinate variables (variables that are also dimensions) as well as the declarations of all dimensions, variables, and attribute values. Data values of non-coordinate variables are not included in the output. This is the most suitable option to use for a brief look at the structure and contents of a netCDF file.-hShow only the header information in the output, that is the declarations of dimensions, variables, and attributes but no data values for any variables. The output is identical to using the -c option except that the values of coordinate variables are not included. (At most one of -c or -h options may be present.)-v var1,...,varnThe output will include data values for the specified variables, in addition to the declarations of all dimensions, variables, and attributes. One or more variables must be specified by name in the comma-delimited list following this option. The list must be a single argument to the command, hence cannot contain blanks or other white space characters. The named variables must be valid netCDF variables in the input-file. The default, without this option and in the absence of the -c or -h options, is to include data values for all variables in the output.-b langA brief annotation in the form of a CDL comment (text beginning with the characters ``//'') will be included in the data section of the output for each `row' of data, to help identify data values for multidimensional variables. If lang begins with C or c, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins with F or f, then Fortran language conventions will be used (one-based indices, first dimension varying fastest). In either case, the data will be presented in the same order; only the annotations will differ. This option is useful for browsing through large volumes of multidimensional data.-f langFull annotations in the form of trailing CDL comments (text beginning with the characters ``//'') for every data value (except individual characters in character arrays) will be included in the data section. If lang begins with C or c, then C language conventions will be used (zero-based indices, last dimension varying fastest). If lang begins with F or f, then Fortran language conventions will be used (one-based indices, first dimension varying fastest). In either case, the data will be presented in the same order; only the annotations will differ. This option may be useful for piping data into other filters, since each data value appears on a separate line, fully identified.-l lenChanges the default maximum line length (80) used in formatting lists of non-character data values.-n nameCDL requires a name for a netCDF data set, for use by ncgen -b in generating a default netCDF file name. By default, ncdump constructs this name from the last component of the pathname of the input netCDF file by stripping off any extension it has. Use the -n option to specify a different name. Although the output file name used by ncgen -b can be specified, it may be wise to have ncdump change the default name to avoid inadvertantly overwriting a valuable netCDF file when using ncdump, editing the resulting CDL file, and using ncgen -b to generate a new netCDF file from the edited CDL file.-d float_digits[,double_digits]Specifies default number of significant digits to use in displaying floating-point or double precision data values for variables that don't have a `C_format' attribute. Floating-point data will be displayed with float_digits significant digits. If double_digits is also specified, double-precision values will be displayed with that many significant digits. If a variable has a `C_format' attribute, that overrides any specified floating-point default. In the absence of any -d specifications, floating-point and double-precision data are displayed with 7 and 15 significant digits respectively. CDL files can be made smaller if less precision is required. If both floating-point and double-presision precisions are specified, the two values must appear separated by a comma (no blanks) as a single argument to the command. If you really want every last bit of precision from the netCDF file represented in the CDL file for all possible floating- point values, you will have to specify this with -d 9,17.Usage Notesncdump generates an ASCII representation of a specified netCDF file on standard output. The ASCII representation is in a form called CDL (``network Common Data form Language'') that can be viewed, edited, or serve as input to ncgen. ncgen is a companion program that can generate a binary netCDF file from a CDL file. Hence ncgen and ncdump can be used as inverses to transform the data representation between binary and ASCII representations. See ncgen for a description of CDL and netCDF representations.ncdump defines a default format used for each type of netCDF data, but this can be changed if a `C_format' attribute is defined for a netCDF variable. In this case, ncdump will use the `C_format' attribute to format each value. For example, if floating-point data for the netCDF variable Z is known to be accurate to only three significant digits, it would be appropriate touse the variable attributeZ:C_format = "%.3g"ncdump may also be used as a simple browser for netCDF data files, to display the dimension names and sizes; variable names, types, and shapes; attribute names and values; and optionally, the values of data for all variables or selected variables in a netCDF file.ExamplesLook at the structure of the data in the netCDF file foo.nc:ncdump -c foo.ncProduce an annotated CDL version of the structure and data in the netCDF file foo.nc, using C-style indexing for the annotations:ncdump -b c foo.nc > foo.cdlOutput data for only the variables uwind and vwind from the netCDF file foo.nc, and show the floating-point data with only three significant digits of precision:ncdump -v uwind,vwind -d 3 foo.ncProduce a fully-annotated (one data value per line) listing of the data for the variable omega, using Fortran conventions for indices, and changing the netCDF dataset name in the resulting CDL file to omega:ncdump -v omega -f fortran -n omega foo.nc > Z.cdl2、注意①它是在dos底下⽤的,如果在gradsnc中⽤,请在命令前加感叹号。
Gradle的使⽤教程⽬录:1、2、3、4、5、1、安装 Gradle 配置gradle默认的仓库地址(和maven不太⼀样) 测试环境变量是否配置成功:2、使⽤ idea 创建⼀个 Gradle 项⽬ 双击 war 打包完成之后的 war ⽂件会在 然后把war放⼊对应的tomcat⽬录即可。
3、 build.gradle 配置⽂件 build.gradle ⽂件是配置项⽬中要使⽤的库的⽂件。
它和 Maven ⼯程中的 pom.xml 相同。
添加 commons-lang3 包plugins {id'java'id'war'}group 'org.oy'version '0.1'sourceCompatibility = 1.8repositories {mavenCentral()}dependencies {testCompile group: 'junit', name: 'junit', version: '4.11'testCompile group: 'junit', name: 'junit', version: '4.12'compile group: 'mons', name: 'commons-lang3', version: '3.0'} 依赖: 使⽤ commons-lang3package com.oy;import ng3.StringUtils;public class demo {public static void main(String[] args) {String text1 = "a12340";String text2 = "1234";boolean result1 = StringUtils.isNumeric(text1);boolean result2 = StringUtils.isNumeric(text2);System.out.println(text1 + " is a numeric? " + result1);System.out.println(text2 + " is a numeric? " + result2);}}4、gradle 本地仓库 默认情况下,Gradle软件将通过 Eclipse 下载到C:/Users/{username}/.gradle⽬录中。
GRADS (Grid Analysis and Display System)讲义(10)GrADS 描述语言及编程一、描述语言概述描述语言是GrADS软件包中自带的高级语言,可以用于GrADS的高级操作,更方便地使用GrADS的功能。
通过描述语言可以编写具有复杂功能的命令集(即gs文件)。
二、gs文件中的两类型语句1)描述语句:不用引号,需要经过编译的。
2)指令性语句:GrADS命令,需用引号括起来。
通过描述语句来控制指令描述语言用到指令性语句中要用引号,即,i=1‘set t ‘i’’(或者‘set t ’ i )三、描述语言程序特点1、程序通过GrADS的run命令来编译执行;run file-name options2、可以有变量、流程控制也可以执行GrADS 的命令。
3、描述语言可以1)编写函数子程序,2)制作屏幕菜单,3)可以显示动画图形,4)可以使用从GrADS的query命令中得到的信息作注释等。
3、描述语言的所有变量都是字符串型的,描述变量可以进行计算。
流程控制是通过if/else/endif和while/endwhile语句块实现。
循环过程可以用continue或break命令改变。
变量中包含的或者由表达式结果产生的字符串可以作为GrADS命令项使用。
而由GrADS命令执行后产生的文字结果可以读入变量并在描述语言程序中使用。
描述语言也支持函数子程序功能。
四、描述语言的组成1、一个描述语言程序是由许多语句组成,每个语句之间由换行号或分号分隔。
2、下面是GrADS描述语言中语句的类型:赋值语句If / Else / Endifwhile / endwhilebreak / continuefunction header / returnsay / pull3、描述表达式描述表达式是由运算对象和运算符组成。
运算对象:描述变量、子程序函数或常数;运算符:数学、逻辑或连结运算符。
下面分别介绍变量、运算符、表达式4、描述语言变量1)构成变量名是由1至8个字符组成,以字母开头,仅可以包含字母和数字,变量名区分大小写。
gradle使用教程Gradle是一个现代化的构建工具,用于帮助管理和构建项目。
它采用了Groovy语言编写,具有强大的构建能力和灵活的配置选项。
本教程将向您介绍如何使用Gradle进行项目管理和构建。
一、安装Gradle首先,您需要安装Gradle。
您可以从Gradle官方网站下载最新版本的Gradle压缩包。
下载完成后,解压缩并将Gradle的bin目录路径添加至系统环境变量中。
二、创建一个Gradle项目1. 创建一个新文件夹作为您的Gradle项目根目录。
2. 在项目根目录中创建一个名为build.gradle的文件,这是Gradle项目的主要配置文件。
三、配置文件1. 打开build.gradle文件,您可以看到以下内容:```apply plugin: ‘java’```这表示您的项目将使用Java插件。
2. 您可以根据需要添加其他插件,例如应用程序插件:```apply plugin: ‘application’```四、定义任务1. 在build.gradle文件中,您可以定义您的项目需要执行的任务。
例如,您可以定义一个用于编译代码的任务:```task compile(type: JavaCompile) {sourceCompatibility = 1.8targetCompatibility = 1.8sourceSets.main.java.srcDirs = ['src/main/java']classpath = sourceSets.main.runtimeClasspathdestinationDir = file('bin')}```这个任务将使用JavaCompiler编译源代码,并将编译结果放在bin目录下。
2. 您还可以定义其他类型的任务,例如清理任务:```task clean(type: Delete) {delete 'bin'```这个任务将删除bin目录及其内容。
1 1: grails222 Examples2 Grails2333 2: REST55 Examples5 grailsREST API5 REST5 HTTPSGrails Server6 3: 77 Examples778 GSP8 4: 9 Examples99911You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: grailsIt is an unofficial and free grails ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official grails.The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners.Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to ********************1: grailsGrailsRAD Java API 。
Groovy入门教程Groovy入门教程**********************一、groovy是什么简单地说,Groovy 是下一代的java语言,跟java一样,它也运行在 JVM 中。
作为跑在JVM中的另一种语言,groovy语法与 Java 语言的语法很相似。
同时,Groovy 抛弃了java烦琐的文法。
同样的语句,使用groovy能在最大限度上减少你的击键次数——这确实是“懒惰程序员们”的福音。
二、开发环境1、 jdk 1.5以上2、 eclipse+groovy plugin(支持Groovy 1.5.7)打开eclipse,通过Software Updates > Find and Install...菜单,使用“Search for new features to install”下载并安装groovy插件。
New一个远程站点,url可使用,插件名:Groovy plug-in。
根据需要你可以同时选择groovy和grails(后续会学习到):三、创建groovy项目1、新建一个groovy项目New --> Project → Java Project 创建一个java项目。
为了方便管理,建议在source中建两个source文件夹java和groovy,分别用于存储java源文件和groovy源文件:2、添加 Groovy 特性在项目上右击,Groovy → Add Groovy Nature,这样会在项目中添加 Groovy Libraries。
3、添加 Groovy 类在项目groovy源文件下右键,New →Other →Groovy →Groovy Class自动生成的源代码如下:public class HelloWorld{/*** @param args*/public static void main(def args){//TODO Auto-generated method stub}}我们在main方法中加一句打印语句:println "Hello World"4、编译运行groovy类在源文件上右键,Compile Groovy File,然后右键,Run As →Groovy ,在控制台中查看运行结果。
构建您的第一个Grails 应用程序【IT168技术文档】请允许我借助另一种开源 Web 开发框架—— Ruby on Rails ——来介绍 Grails。
Rails 一发布就迷住了开发人员。
Rails 的脚手架功能使您可以用以前所需时间的一小部分完成一个新的项目。
支持 Rails 的约定优于配置(convention over configuration)思想意味着,应用程序可以根据常识性的命名模式自动进行组装(auto-wire),而不必借助繁杂的、容易出错的 XML 配置文件。
Ruby 的元编程功能使对象可以神奇地在运行时继承所需的方法和字段,而不会扰乱源代码。
Rails 配得上它所受到的赞美和推崇(现在仍然如此),但是它使 Java 开发人员面临困难的选择。
您会因为一个新平台的承诺而放弃自己熟悉的 Java 平台吗?如何处理已有的 Java 代码、已有的生产服务器和经验丰富的 Java 开发人员?关于本系列Grails 是一种新型 Web 开发框架,它将常见的 Spring 和 Hibernate 等 Java 技术与当前流行的约定优于配置等实践相结合。
Grails 是用 Groovy 编写的,它可以提供与遗留 Java 代码的无缝集成,同时还可以加入脚本编制语言的灵活性和动态性。
学习完 Grails 之后,您将彻底改变看待 Web 开发的方式。
Grails 为您提供 Rails 风格的开发体验,同时以可靠的 Java 技术作为坚强后盾。
但是 Grails 不仅仅是 Rails 通往 Java 平台的简单入口。
Grails 吸取了 Rails 的经验,并将它们与现代 Java 开发的意识相结合。
可以认为 Grails 是受 Rails 启发,而不是由 Rails 转化而来。
作为 Grails 入门系列的开篇,本文介绍 Grails 框架,展示它的安装方法,遍览如何构建第一个Grails 应用程序:介绍本系列后续文章的内容。
Groovy 的威力就像 Rails 与 Ruby 编程语言联系非常紧密一样,Grails 也离不开 Groovy(请参阅参考资料)。
Groovy 是一种动态语言,它在 JVM 上运行,并且与 Java 语言无缝集成。
如果阅读了 developerWorks 上的大型实战 Groovy 系列,那么您已经了解了这种语言的威力。
如果没有,也不必担心—在学习 Grails 的过程中,您将了解到很多关于 Groovy 的知识。
Groovy 应该不难学,因为它是特意为 Java 开发人员而设计的。
例如,Groovy 可以大大减少 Java 代码的数量。
在 Groovy 中,不再需要为字段编写 getter 和setter 方法,因为 Groovy 会自动提供它们。
不再需要编写 for Iterator i = list.iterator() 来循环遍历一系列的项;list.each 可以做相同的事情,而且看上去更简洁,表达更清晰。
简言之,Groovy 就是 21 世纪的 Java 语言。
如果 Java 开发人员只有重新编写整个应用程序才能利用 Groovy,那么 Groovy 对他们就没有多大的吸引力了。
令人高兴的是,Groovy 可以无缝地与已有的代码库集成。
Groovy 不会替代 Java 语言—它只是提供了增强。
您可以很快地掌握 Groovy,因为说到底,Groovy 代码就是 Java 代码。
这两种语言是如此兼容,甚至可以将一个 .java 文件重命名为一个 .groovy 文件—例如,将 Person.java 改为Person.groovy —从而得到一个有效的(可执行的)Groovy 文件(虽然这个 Groovy 文件并没有用到Groovy 提供的任何语法)。
Groovy 与 Java 语言的深度兼容意味着 Grails 不需要重新创造内部使用的关键技术。
相反,您可以以 Groovy 的方式查看熟悉的 Java 库。
Groovy 封装了 JUnit TestCase 并以 GroovyTestCase 形式提供。
Grails 通过 GANT 对 Ant 构建进行了调整,GANT 是 Ant 的一个纯 Groovy 实现。
Grails 将Hibernate 包装在一个小小的 Groovy facade 中,并称之为 GORM —Grails Object/Relational Mapper。
Grails 使您在利用已有的 Java 经验的同时,还可以利用最新的 Web 开发实践,以上只是其中的三个例子。
不过,要想全面地鉴赏 Grails,还需要亲身体验一下。
现在,让我们来安装 Grails,并创建第一个Web 应用程序。
安装 Grails运行 Grails 应用程序所需的一切都在一个 ZIP 文件中。
所有的依赖库—例如 Groovy、Spring 和Hibernate —都已经在那里,随时可以使用。
要安装 Grails:1.从 Grails 站点下载并解压 grails.zip。
2.创建一个 GRAILS_HOME 环境变量。
3.将 $GRAILS_HOME/bin 添加到 PATH 中。
您的确需要安装一个 JDK(Grails 是不错,但是还没有好到那种程度)。
Grails 1.0 可在 Java 1.4、1.5 和 1.6 上运行。
如果不知道已经安装了哪个版本,可以在命令行提示符下输入 java -version。
必要时,下载并安装一个与 Grails 兼容的 JDK(见参考资料)。
完成安装步骤后,输入 grails -version 以进行检查。
如果看到以下友好信息,则说明一切都得到正确配置:Welcome to Grails 1.0 - /Licensed under Apache Standard License 2.0Grails home is set to: /opt/grails附带的 Web 服务器和数据库有趣的是,不需要单独安装 Web 服务器就可以运行 Grails 应用程序。
Grails 内置了 Jetty servlet 容器。
只需输入 grails run-app,就可以使应用程序在 Jetty 容器(见参考资料)中运行,而不必执行常见的部署过程。
在已有的生产服务器上运行 Grails 应用程序也没有问题。
通过输入 grails war 创建一个标准文件,然后可以将其部署到 Tomcat、JBoss、Geronimo、WebSph ere®,或者任何其他遵从 Java EE 2.4 的 servlet 容器。
您也不需要单独安装数据库。
Grails 附带了 HSQLDB(见参考资料),它是一个纯 Java 数据库。
通过提供一个随时可用的数据库可以立即提高生产率。
由于有了 Hibernate 和 GORM,使用其他数据库(例如 MySQL、PostgreSQL、Oracle Database 或 DB2)也很简单。
如果有一个 JDBC driver JAR 再加上通常的连接设置,只需改变一下 DataSource.groovy,就可以立即使用您自己的数据库。
编写第一个 Grails 应用程序我经常旅行—一年至少 40 趟。
我发现,日程表可以很好地告诉我何时需要达到某个地方,但是不能显示那个地方在哪里。
而在线地图刚好相反:它们可以解决地点问题,但不能解决时间问题。
所以,在本文和本系列接下来的两篇文章中,您将构建一个定制的 Grails 应用程序,在计划旅程时,这个应用程序既可以用于解决时间问题,又可以用于解决地点问题。
首先,在一个空白目录下,输入 grails create-app trip-planner。
稍后,可以看到一个名为trip-planner 的目录。
同 Maven、Rails 和 AppFuse 一样,Grails 会建立一个标准的目录结构。
如果您觉得这个目录结构限制了您,并且只有精心设计自己的定制目录树才能使用一个框架,那么这样使用Grails 不会有多大的乐趣。
约定优于配置中的约定部分使您可以拥有任何 Grails 应用程序,并立即知道各个部分之间的联系。
进入 trip-planner 目录,并输入 grails create-domain-class Trip。
如果一切顺利,将得到两个新的文件:grails-app/domain/Trip.groovy 和 grails-app/test/integration/TripTests.groovy。
在后面的文章中,我将谈到测试。
目前,我们主要关注域类。
一开始,域类看上去如清单 1 所示:清单 1. Grails 生成的域类class Trip{}看上去没什么内容,对吗?接下来让我们来完善它。
为 Trip 添加一些字段,如清单 2 所示:清单 2. 添加字段后的 Trip 类class Trip {String nameString cityDate startDateDate endDateString purposeString notes}如前所述,这里不需要创建 getter 和 setter 方法:Groovy 会动态地生成它们。
Trip 还有很多新的、有用的动态方法,这些方法的名称非常易用理解:·Trip.save() 将数据保存到 HSQLDB 数据库中的 Trip 表中。
·Trip.delete() 从 Trip 表中删除数据。
·Trip.list() 返回一个 Trip 列表。
·Trip.get() 返回一个 Trip。
所有这些方法都已经存在,您在需要的时候就可以使用它们。
注意,Trip 并没有扩展某个父类或者实现某个接口。
由于 Groovy 的元编程功能,那些方法只是出现在适当类中的适当位置(只有grails-app/domain 目录中的类才拥有这些与持久性相关的方法)。
构建控制器和视图创建域类只是成功的一半。
每个模型都还需要一个良好的控制器和一些视图(我假设您熟悉Model-View-Controller 模式;请参阅参考资料)。
输入 grails generate-all Trip,以构建一个grails-app/controllers/TripController.groovy 类,并在 grails-app/views/Trip 中生成一组匹配的Groovy Server Page(GSP)。
对于控制器中的每个 list 动作,都有一个相应的 list.gsp 文件。
create 动作则对应于一个 create.gsp 文件。
从这里可以看出约定优于配置的优点:无需 XML 文件就可以匹配这些元素。