Netcdf Java User Manual
- 格式:pdf
- 大小:874.99 KB
- 文档页数:41
java netconf 用法Netconf(Network Configuration Protocol)是一种网络设备配置管理协议,它使用XML格式进行配置和管理网络设备。
在Java中,可以使用Netconf4j库来实现对网络设备的Netconf 操作。
以下是Java Netconf的用法的详细内容:1. 添加Netconf4j库的依赖在Java项目的pom.xml文件中添加Netconf4j库的依赖项:```xml<dependency><groupId>com.tailf.jnc</groupId><artifactId>jnc</artifactId><version>1.3.0</version></dependency>```2. 创建Netconf会话在Java代码中创建Netconf会话,连接到目标网络设备:```javaString host = "设备IP地址";int port = 830; // 默认Netconf端口String username = "用户名";String password = "密码";NetconfSession session = new NetconfSession(host, port, username, password);session.connect();```3. 发送Netconf操作请求使用NetconfSession对象发送Netconf操作请求,例如获取设备配置、修改设备配置等:```java// 获取设备配置String getConfigRequest = "<rpc><get-config><source><running/></source></get-config> </rpc>";NetconfResponse getConfigResponse = session.sendRpcRequest(getConfigRequest);String config = getConfigResponse.getData();// 修改设备配置String editConfigRequest = "<rpc><edit-config><target><running/></target><config>修改的配置</config></edit-config></rpc>";NetconfResponse editConfigResponse = session.sendRpcRequest(editConfigRequest);```4. 断开Netconf会话在使用完Netconf会话后,记得断开会话连接:```javasession.disconnect();```这样,你就可以使用Java来实现对网络设备的Netconf操作了。
WRF安装手册--给所有挣扎在安装WRF泥淖中的朋友们作者:SJ modified by Jiangzq网上有很多指导安装WRF及其组件的文章,也有很多帮助解决安装过程中各种困难的帖子,但大多分散且不系统,下面我就以过来人的身份把我在PC上安装WRF的步骤及遇到的各种问题和答案放在模式联盟论坛上,希望能帮助那些正在挣扎于安装WRF泥淖中的各位,同时也纪念下我之前所经历的这种痛苦。
1、安装平台fedora82、所需的各种组件:1)PGI 7.15 + netcdf4.0 +NCL(==ncarg) !其实ifort的性能比PGI更好,但是其他的都过了,只在安装WRFDA的过程中一直编译不过去,因此暂不介绍ifort编译WRF的过程。
2)WRFV3.1 + WPSV3.0.1 + WRFDA V3.0.1(if needed)3)RIP43、安装PGI1)解PGI压缩包$cd /home/name/Model$mkdir PGI$tar -xvf pgilinux-715.tar.gz -C PGI$cd PGI$./install !出现提示信息Do you accept these terms? [accept,decline]accept1,Sinle system install2,Network install1Install the ACML? [y/n]nInstallation directory?[/opt/pgi]/home/name/Program/pgiDo you wish to install MPICH1? [y/n]nDo you want the files in the install directory to be read-only?[y/n]ninstall complete$cp license.dat /home/name/Program/PGI !把与安装版本相适应的license.dat拷贝到你安装的目录下配置.bashrc里的环境变量export PGI=/home/name/program/pgi/linux86/7.1-5/export MANPATH=$MANPATH:$PGI/manexport LM_LICENSE_FIEL=/home/name/program/pgi/license.datexport PATH=$PATH:$PGI/bin$source .bashrc为了试验pgi是否安装成功,可以打如下命令$pgf90如果有如下提示信息,说明已安装成功$pgf90 –warning-No files to process***************************************************************************在Fedora11下安装pgi_9.0-1高版本的fedora下同样需要安装高版本的pgi,但其安装步骤基本一样,只是它里面有一个patcher需要安装罢了。
NetCDF介绍目录一、NetCDF文件介绍 (2)1、简介 (2)2、netCDF优点 (2)3、NetCDF缺点 (2)二、NetCDF文件结构 (3)1、结构描述 (3)2、结构之间的内在联系 (3)三、NetCDF 接口函数库 (5)1、NetCDF 接口函数库 (5)2、C版本的NetCDF 数据的接口函数库简介 (6)四、总结 (6)五、附录: ....................................................................................................... 错误!未定义书签。
一、NetCDF文件介绍1、简介NetCDF(Network Common Data Form,通用的网络数据格式)是由美国大学大气研究协会UCAR(University Cooperation for AtmosphereResearch)下Unidata 项目科学家针对科学数据的特点,提出的一种面向数组型数据,适于网络共享的数据描述和编码标准。
其用意是在Unidata计划中不同的应用项目下,提供~种可以通用的资料存取方式,资料的形状包括单点的观测值、时间序列、规则排列的网格,以及人造卫星或雷达的影像文件。
其软件实现形式是一个免费的NetCDF软件包,内含可访问NetCDF数据的工具程序和多种语言的接口函数库。
它独立于机器并用于保存科学数据,同时也是一个数据类库接口,该数据类库包含了访问数组格式的功能。
这种格式的接口、类库都支持产生、访问和共享科学数据。
2、netCDF优点(1)、可以使用统一的接口来直接读写不同的气象资料,方便数据的管理。
(2)、NetCDF格式文件具有自描述性,即NetCDF不仅包含了数据资料,还包括了描述数据特征的属性,这也是网络时代数据的趋势性特征。
(3)、平台无关性。
即NetCDF文件支持在不同平台间的数据传输,这使得NetCDF 文件易于网络中共享。
java读取⽓象专业格式NetCDF⽂件⼀、NetCDF简介NetCDF全称为network Common Data Format( “⽹络通⽤数据格式”),是⼀个软件库与机器⽆关的数据格式,⽀持创建,访问基于数组的科研数据。
分别提供了对Java和C / C++ / Fortran语⾔。
对程序员来说,它和zip、jpeg、bmp⽂件格式类似,都是⼀种⽂件格式的标准。
netcdf⽂件开始的⽬的是⽤于存储⽓象科学中的数据,现在已经成为许多数据采集软件的⽣成⽂件的格式。
从数学上来说,netcdf存储的数据就是⼀个多⾃变量的单值函数。
⽤公式来说就是f(x,y,z,…)=value, 函数的⾃变量x,y,z等在netcdf中叫做维(dimension)或坐标轴(axix),函数值value在netcdf中叫做变量(Variables)。
⽽⾃变量和函数值在物理学上的⼀些性质,⽐如计量单位(量纲)、物理学名称在netcdf中就叫属性(Attributes)。
⼆、需要⽤到的netcdf的jar下载地址:本⽂使⽤版本:netcdfAll-4.6.14.jar需要java 的jdk 8以上版本三、读取和打印经纬度变量,了解数据组织结构public static void main(String[] args) {String filename = "pres_temp_4D.nc";NetcdfFile dataFile = null;try {dataFile = NetcdfFile.open(filename, null);// Get the latitude and longitude Variables.Variable latVar = dataFile.findVariable("latitude");Variable lonVar = dataFile.findVariable("longitude");System.out.println(NCdumpW.printVariableData(latVar, null));System.out.println(NCdumpW.printVariableData(lonVar, null));ArrayFloat.D1 latArray;ArrayFloat.D1 lonArray;latArray = (ArrayFloat.D1) latVar.read();lonArray = (ArrayFloat.D1) lonVar.read();System.out.println(NCdumpW.printArray(latArray, "lat", null));System.out.println(NCdumpW.printArray(lonArray, "lon", null));// The file is closed no matter what by putting inside a try/catch block.} catch (java.io.IOException e) {e.printStackTrace();return;} catch (InvalidRangeException e) {e.printStackTrace();return;} finally {if (dataFile != null)try {dataFile.close();} catch (IOException ioe) {ioe.printStackTrace();}}System.out.println("*** SUCCESS reading example file " + filename);}NC数据格式:经度:从左到右(正⾛),纬度:从下到上(正⾛).read():是读取这个变量所有的数据。
netcdf4.1.3安装后环境变量设置以及Qt下使用静态动态库方法一.netcdf4.1.3安装后环境变量设置1.下载netcdf安装包,from:/downloads/netcdf/index.jsp我下载的是版本4.1.32.解压tar -zxvf netcdf-4.1.3.tar.gz3. 在解压后的netcdf-4.1.3所在目录执行:./configure --disable-dap --disable-netcdf-4 --prefix=/usr/local/netcdf注意:上面红色的两个选项是他人很多次实验后证明必须的(参考资料1)。
--disable-dap的原因是缺少一个‘curl’的lib,--disable-netcdf-4是报错中提出的解决办法,尽管我个人暂时没有搞清楚为什么。
不写这两个,在configure的时候就会报错,导致后面make失败。
4. make5. make install,提示安装成功的同时,还会提醒make check,下一步进行。
6. make check安装完成后,/usr/local/netcdf/文件夹下存在4个文件,分别为bin,include,lib和share安装完成后,注意环境变量的设置打开终端输入sudo ~/.bashrc在最后添加exportPATH=/home/swh/NSForWoss/DESERT_all_in_one_1.0.0/netcdf/bin:/$P ATHexportLD_LIBRARY_PATH=/home/swh/NSForWoss/DESERT_all_in_one_1.0 .0/netcdf/lib:/$ LD_LIBRARY_PATHexportDYLD_LIBRARY_PATH=/home/swh/NSForWoss/DESERT_all_in_one _1.0.0/netcdf/lib:/$ DYLD_LIBRARY_PATH测试环境变量是否生效输入ncdump会出现如下阴影区域,说明安装成功二.Qt下使用静态动态库方法要想读取netcdf文件(后缀为.nc),我们需要使用上面安装的nefcdf。
中科院南海所HPCC高性能集群用户使用手册一、集群系统简介与登陆本集群包含一个管理节点兼存储节点,16个刀片计算节点,其中每个计算节点包含2个CPU,每个CPU有6个核组成,32G内存。
网络子系统由1台Dell M6220千兆交换机,用于管理网络,和1台Dell M3601Q 40G Infiniband交换机用于计算网络组成。
存储子系统为DELL MD3200 提供20T的存储空间。
本集群各节点操作系统为Redhat 5.5。
集群目前使用SSH登录,登录IP为:210.77.91.107用户登陆登陆管理节点内/外网地址210.77.91.107 ssh port 22登陆计算节点ssh node-00-00~node-00-15远程登陆软件Putty、SSHSecureShellClientPutty获取地址/~sgtatham/putty/download.html输入登陆地址:在图”HostName(orIPaddress)”中输入IP:210.77.91.107,选中SSH协议,选择Port为22;为这个连接起一个名字,在”SavedSessions”中输入此名字”南海所集群”。
点击save按钮,这样”DefaultSettings”字样以下会出现“南海所集群”字样。
登录后的界面如下图:二、编译系统gcc v4.1.2: /usr/bingfortran v4.1.2: /usr/binperl v5.8.8 : /usr/binPGI: /opt/pgi/linux86-64/9.0-1/bin/Intel: /opt/intel/Compiler/11.1/064三、并行环境GCC编译的openmpiOpen MPI: /usr/lib64/openmpi/1.4-gcc/bin/PGI编译的openmpiOpenmpibypgi : /opt/openmpibypgi/binifort编译的openmpiopenmpibyifort : /opt/openmpibyifort/bingcc编译的mpich1MPICH1: /opt/mpich1/gnu/bingcc编译的mpich2MPICH2: /opt/mpich2/gnu/bingcc编译的mvapichMV APICH: /usr/lib64/mvapich2/1.4-gcc/binpgi编译的mvapichMV APICH2byPGI: /opt/mvapich2bypgi/binifort编译的mvapichMV APICH2byifort: /opt/mvapich2byifort/bin四、应用软件Matlab2010a :/opt/matlab/binnetcdf4 :/opt/netcdf4/binncl或ncarg :/usr/local/ncarg/binGards :/opt/grads/binncview :/opt/ncviewRIP4 :/opt/RIP4ferret :/usr/local/ferretUdunits2 :/opt/udunits/lib五、作业调度系统Platform Lava,强大的开源作业调度程序任务提交方法简介见第七节六、环境变量设置这是全局的环境变量,每个用户默认的环境变量#mvapichbypgiexport MPIHOME=/opt/mvapich2bypgiexport PA TH=/opt/mvapich2bypgi/bin:$PATHexport LD_LIBRARY_PA TH=$LD_LIBRARY_PA TH:/opt/pgi/linux86-64/9.0-1/libso#PGI PA THexport PGI=/opt/pgi/linux86-64/9.0-1export PA TH=$PGI/bin:$PA THexport MANPATH=$PGI/man:$MANPA THexport LM_LICENSE_FILE=$LM_LICENSE_FILE:/opt/pgi/license.dat#NCARGexport NCARG_ROOT=/usr/local/ncargexport PA TH=/usr/local/ncarg/bin:$PATHexport DISPLAY=:0.0export NCARG_LIB=/usr/local/ncarg/libexport NCARG_INC=/usr/local/ncarg/include#GrADSexport GADDIR=/opt/grads/datexport GASCRP=/opt/grads/libexport PA TH=/opt/grads/bin:$PA THalias grads=/opt/grads/bin/grads#NetCDFexport NETCDF=/opt/netcdf4export PA TH=$NETCDF/bin:$PA THexport NETCDF_LIBS=/opt/netcdf4/lib#RIP$export RIP_ROOT=/opt/RIP4export PA TH=$PATH:$RIP_ROOT#ferretexport FER_DIR=/usr/local/ferretexport PA TH=$FER_DIR/bin:$PA TH#udunits2export UDUNITS2_LIBS=/opt/udunits/libexport PA TH=/opt/udunits/bin:$PA TH#ncviewexport PA TH=/opt/ncview/bin:$PA THexportPATH="$PATH:/usr/lib64/openmpi/1.4-gcc/bin:/opt/intel/Compiler/11.1/064/bin:/opt/intel/Compil er/11.1/064/bin/intel64/:/opt/pgi/linux86-64/9.0-1/bin:/opt/matlab/bin:/opt/netcdf4/bin"由于每个用户可能使用的软件或者模式的环境变量不在上面的路径上,则需要每个用户修改自己的环境变量,文件为在自己的home目录下的.bashrc文件例如:假如我的用户名为lwf,则环境变量位于/home/lwf目录下修改.bashrc文件用文本编辑器打开用户目录下的.bashrc文件,例如vi命令(1)例如我新安装了JA V A程序,则在.bashrc文件末尾加入:JA V A_HOME=/home/lwf/jdk1.5.0_05export JA VA_HOMEPATH=$JA V A_HOME/bin:$PATHexport PA THCLASSPATH=.:$JA V A_HOME/lib/dt.jar:$JA V A_HOME/lib/tools.jarexport CLASSPATH(2)新加入完后保存,然后使用source命令使其生效。
NETCDF 软件库使用指南2009年4月中国科学院计算机网络信息中心超级计算中心联系人:高晋芳E-mail:jfgao@目录NETCDF 软件库使用指南 (1)1. NETCDF介绍 (3)2. NETCDF的安装 (3)安装目录2.1 (3)2.2 (3)安装过程3. NETCDF使用方法 (4)1. NETCDF介绍NetCDF是基于数组存取的接口库,它定义了一种与机器平台无关的格式,用来表示科学计算的数据格式。
同时还定义了这种格式的存取和其他各种数据的操作,它是由Unidata Program Center in Boulder, Colorado开发的免费软件,多用于WRF等大型软件中。
NETCDF目前最新的版本是4.0.1。
2. NETCDF的安装2.1 安装目录集群部分/home_soft/soft/x86_64/apps/OpenSoft/NETCDF/netcdf-4.0.1/胖节点/home_soft/soft/ia64/apps/OpenSoft/NETCDF/netcdf-4.0.1/2.2 安装过程1.下载最新安装软件包netcdf.tar.gz。
(地址/software/netcdf/ )2.将netcdf.tar.gz上传至安装目录下,执行“tar xzfv netcdf.tar.gz”解压缩包。
3.查看./README文件,以寻找合适的编译器、设置编译选项,进行编译库等。
4.安装步骤(示例):1)修改configure中的prefix选项为“安装目录”/install(最终的安装结果均在此文件夹中)2)执行“./configure”生成Makefile文件3)修改Makefile中的编译器选项,包括:CC/CPP/C++/F77/FC/CXX/CXXCPP,修改Makefile中的编译选项,包括:CPPFLAGS/CFLAGS/FCFLAGS等选项,同时在CPPFLAGS中加入-Df2cFortran(WRF2GRADS编译中用到)。
ERP软件部 NetWeaver7.0配置手册-初级版本 <内测版本>目录1.简介 (4)1.1目的 (4)1.2范围 (4)1.3定义、首字母缩写词和缩略语 (4)1.4参考资料 (4)1.5概述 (4)2.配置NETWEAVER (4)2.1为什么需要配置? (4)2.2BOUNCYCASTLE JCE (4)2.3更新ORACLE驱动 (6)2.4调整JVM参数 (7)3.配置系统运行日志 (9)4.安装部署FMIS服务端程序 (11)4.1配置FMIS数据源 (11)4.2更新FMIS服务程序包 (15)4.3部署FMIS服务程序包 (15)4.4卸载FMIS (16)5.常见问题(FAQ) (18)5.1为什么? (18)5.2为什么? (18)5.3为什么? (19)5.4为什么? (19)5.5如何? (19)6.附录A:如何 (19)NetWeaver7.0配置手册-初级1.简介本文档包括了NetWeaver7.0的配置管理以及日常维护过程中会出现的部分的解决方法。
1.1目的1.2范围NetWeaver7.01.3定义、首字母缩写词和缩略语1.4参考资料1.5概述2.配置NetWeaver进行配置前,请确认NetWeaver已经启动。
确认方式:http://IP:端口/nwa 可正常访问。
2.1为什么需要配置?因为需要配置…2.2bouncycastle JCEFMIS 服务端借助bouncycastle JCE完成数据的加密解密功能。
复制bcprov-jdk14-137.jar,bcmail-jdk14-137.jar至JRE的lib\ext目录中。
例如:D:\j2sdk1.4.2_19\jre\lib\ext注:如何判断NetWeaver的java.ext.dirs目录?访问 http://IP:端口/sap/monitoring/SystemInfo,点击Instance的server的VM的SystemProperties,在打开的页面中查找“java.ext.dirs”。
NetCDF-Java (version 2.2) User’s ManualJohn Caron, August 18, 20041.I NTRODUCTION (2)2.D ATA L AYER:N ETCDF F ILE (3)Data Layer Object Model (3)Object Names (4)Array section syntax (5)The NetCDF API (6)2.1 ucar.nc2.Dimension (6)2.2 ucar.nc2.DataType (6)2.3 ucar.nc2.Attribute (6)2.4 ucar.nc2.Group (7)2.5 ucar.nc2.Variable (7)2.6 ucar.nc2.Structure (9)2.7 cdfFile (10)2.8 cdfFileWriteable (11)3.S EMANTIC L AYER:N ETCDF D ATASET (12)3.1 Standard Attributes (12)3.2 Coordinate Systems (13)3.3 NetcdfDataset API (15)4S CIENTIFIC D ATA T YPES (17)4.1 GeoGrids (17)4.2 PointData (19)5.N ET CDF M ARKUP L ANGUAGE (N C ML) (20)5.1 NcML Coordinate Systems (21)5.2 NcML Dataset (21)6.M ULTIDIMENSIONAL A RRAYS (22)6.1 ucar.ma2.Array: in-memory multidimensional arrays (22)6.2 ucar.ma2.Index (23)6.3 ucar.ma2.IndexIterator (24)6.4 Type and rank specific Arrays (24)7I MPLEMENTATION (27)7.1 Remote access to netCDF files through an HTTP server (27)7.2 Reading HDF5 Files (27)7.3. NetCDF – OpenDAP Interface (29)IOServiceProvider (31)Read data from a Variable (32)Read data sections from a Variable (32)Read Variable data into a Java array (32)Create a netCDF File (33)Print data from a netCDF dataset (35)A PPENDIX B:E XAMPLE O PEN DAP TO NET CDF C ONVERSION (36)Example: Scalars and Arrays of Primitives (36)Example: Grids and Structures (36)Example: Arrays of Structures (38)Example: Sequences (39)A PPENDIX C (39)ISO 8601 Date Types (39)R EFERENCES (41)1. IntroductionThis is user documentation for version 2.2 of the ucar.nc2, ucar.ma2 and related Java packages, also known as "NetCDF-Java version 2" and "MultiArray version 2" packages.NetCDF-Java version 2.2 provides an Application Programmer Interface (API) for a scientific data model called the Common Data Model (CDM). The CDM is the result of merging the NetCDF (version 3), OpenDAP (version 2), and the HDF5 (version 1.6) data models. NetCDF and HDF5 define standard file formats, while OpenDAP is a network data access protocol. These handle the details of data access, and (for NetCDF and HDF5) file layout and data writing.The Common Data Model has several layers, which build on top of each other to add successively richer semantics:1.The data layer, also know as the syntactic layer, handles data reading and writing. The base datatype for this layer is the multidimensional array.2.The standard attribute layer knows about some of the meanings that humans associate withscientific data: units, missing data values, coordinate systems, data topology, etc. This layerprovides standard methods for common tasks in order to make the application programmer's task easier.3.The coordinate system layer identifies the coordinates of the data arrays. Coordinates are acompletely general concept for scientific data; we also identify specialized georeferencingcoordinate systems, which are important to the Earth Science community.4.The scientific data type layer identifies specific types of data, such as grids, images, and pointdata, and adds specialized methods for that kind of data.NetCDF-Java version 2.2 currently provides read/write access to NetCDF-3 files, read access to most HDF5 files, and read access to OpenDAP datasets. It will also provide read/write access to NetCDF-4 files as that file format becomes available. We are also working on read access to GRIB files, as well as integration with THREDDS dataset annotation.All of these packages are freely available and the source code is released under the Lesser GNU Public License [LGPL]. They require Java version 1.4 or above.2. Data Layer: NetcdfFileData Layer Object ModelIt is useful to understand the Common Data Model as an abstract data model (a.k.a. an object model) independent of its APIs, which are language dependent, or its file format, which is really an implementation detail. Here is the object model for the CDM data layer:Fig 1.NetCDF-Java 2.2 Abstract Data Model in UMLA Dataset is a generalization of a netCDF file. It may be a netCDF file, an HDF5 file, an OpenDAP dataset, a collection of files, or anything else which can be accessed through the netCDF API.A Variable is a container for data. It has a dataType, a set of Dimensions that define its array shape, and optionally a set of Attributes.A Group is a logical collection of Variables. The Groups in a Dataset form a hierarchical tree, like directories on a disk. A Group has a name and optionally a set of Attributes. There is always at least one Group in a dataset, the root Group, whose name is the empty string.A Dimension has an index length, and is used to define the array shape of a Variable. It may be shared among Variables, which provides a simple yet powerful way of associating Variables. When a Dimension is shared, it has a unique name within the Dataset. It may have a coordinate Variable, which gives each index a coordinate value.An Attribute has a name and a value, used for associating arbitrary metadata with a Variable or a Group. The value can be a one dimensional array of Strings or numeric values.A Structure is a type of Variable that contains other Variables, analogous to a struct in C. In general, a Structure's data are physically stored close together on disk, so that it is efficient to retrieve all of the data in a Structure at the same time.A Sequence is a one dimensional Variable whose length is not known until you actually read the data. All other Variable types know what their array lengths are without having to read the data. You can have sequences of sequences, which is equivalent to ragged arrays.An Array contains the actual data for a Variable, read from the disk or network, and stored in memory. You get an Array from a Variable by calling read() or its variants.StructureData contains the actual data for a Structure, like an Array does for a Variable.A String is a variable length array of UTF-8 encoded Unicode characters.The primitive types are boolean, byte, char, short, int, long, float and double, same as in the Java language. Together with String and Structure, these correspond to a Variable's DataType. (LOOK: what about signed / unsigned?)Object NamesGroups, Variables, Dimensions and Attributes can be located by name. The full name of a Group or Variable includes the parent group names separated by a "/", as in file names in directories, e.g."group1/group2/varName". (Note that the root group name is an empty name, rather than "/". This makes objects in the root group look like they are directly contained in the Dataset, for backwards compatibility). When a Variable is a member of a Structure, a "." is used to separate the structure names, e.g."group1/group2/struct1.struct2.varName". These rules imply that a Variable's short name is unique within its containing Group, or within its containing Structure.An Attribute's short name is unique within the Group or Variable it belongs to. Its full name uses an "@" as separator e.g. "group1/varName@attName".[ Dimension short names are unique within the Group it belongs to. Its full name uses the usual "/" as group separator e.g. "group1/group2/dimName". ]-OR- (hard to do both)[ Dimensions are scoped by the Group they belong to. When a Variable refers to a Dimension by name, the Dimension is looked for in the Variable's parent group, and if not found, in its parent, etc. ]The character set for Object names is restricted. A name must start with a letter or underscore (however, starting with an underscore is reserved for system defined objects). The rest of the name must be an alphanumeric character or dash '-' or underscore '_'. [what about escaping other characters? it does make life harder ]Array section syntaxArray sections can be specified with Fortran 90 array section syntax, using zero-based indexing. For example, varName(12:22,0:100:2,:,17)specifies an array section for a four dimensional variable. The first dimension includes all the elements from 12 to 22 inclusive, the second dimension includes the elements from 0 to 100 inclusive with a stride of 2, the third includes all the elements, and the fourth includes just the 18th element. For structures, you can specify nested selectors, e.g. record(12).wind(1:20,:,3)does a selection on the wind member variable on the record structure at index 12. If you don’t specify a section, it means read the entire variable, e.g. record.wind indicates all the wind variables in all the record structures. Formally:variableSection := selector | selector '.' selectorselector := varName ['(' sectionSpec ')']varName := STRINGsectionSpec:= dim | dim ',' sectionSpecdim := ':' | slice | start ':' end | start ':' end ':' strideslice := INTEGERstart := INTEGERstride := INTEGERend := INTEGERwhere:varName = valid variable name':' = all indicesslice = one index = to given valuestart:end = all indices from start to end inclusivestart:end:stride = all indices from start to end inclusive with given strideThis notation is used in the NetcdfFile.read( String variableSection, boolean flatten), Variable.read( String sectionSpec), and NCdump methods.The NetCDF APIThe following is an overview of the important public interfaces of the ucar.nc2 classes. Consult the javadoc for complete details.2.1 ucar.nc2.DimensionA Dimension object specifies the length of an array dimension. If the Dimension is shared, then it has a name that is unique within its Group. Otherwise it is an anonymous dimension that is local to the Variable that uses it, and it doesn’t have a name. If the Dimension is unlimited, then the length can increase; otherwise, it is immutable. A sequence Variable can have a Dimension that is unknown, whose length varies for each Variable that uses it, which can only be determined by actually reading the Variable's data. public class Dimension {public String getName();public int getLength();public boolean isUnlimited();public boolean isUnknown();public boolean isShared();public Variable getCoordinateVariable(); // null if none}The method getCoordinateVariable() returns the associated coordinate variable or null if none exists. A coordinate variable is defined as a Variable with the same name as the Dimension, whose single dimension is the Dimension, for example: float lat(lat);When a variable is displayed in NCdump or equivalent program, its shape is indicated by its dimensions, e.g. varName(time=12, lat=114, lon=288). When a variable uses non-shared (anonymous) dimensions, just the dimension lengths are shown, e.g. varName( 21, 114, 288). When the variable is a sequence, so the length is unknown, a "*" is used, e.g. varName(*).2.2 ucar.nc2.DataTypeDataType is an enumeration of the possible data types that a Variable can take.public class DataType {public static final ucar.nc2.DataType BOOLEAN;public static final ucar.nc2.DataType BYTE;public static final ucar.nc2.DataType CHAR;public static final ucar.nc2.DataType SHORT;public static final ucar.nc2.DataType INT;public static final ucar.nc2.DataType LONG;public static final ucar.nc2.DataType FLOAT;public static final ucar.nc2.DataType DOUBLE;public static final ucar.nc2.DataType STRING;public static final ucar.nc2.DataType STRUCTURE;public static DataType getType(String name); // find by namepublic static DataType getType(Class class); // find by classpublic String toString(); // eg "double"public Class getPrimitiveClassType(); // eg double.classpublic Class getClassType(); // eg Double.class}2.3 ucar.nc2.AttributeAn Attribute is a (name, value) pair, where the value may be a scalar or one dimensional array of String or Number. An Attribute is attached to a Variable or a Group.public class Attribute {public String getName();public DataType getDataType();public boolean isString();public int getLength(); // = 1 for scalarspublic Array getValues();public String getStringValue();(public String getStringValue int elem);public Number getNumericValue();public Number getNumericValue(int elem);}2.4 ucar.nc2.GroupA Group is a container for variables, attributes, dimensions, or other groups. Groups form a tree of nested groups, similar to file directories. There is always at least one group in a NetcdfFile, the root group, which has an empty string as its name. The full name of a group uses "/" as separator, so "group1/group2/group3" names group3 with parent group2 with parent group1, with parent the root group.public class Group {public String getName(); // full name, starting from root grouppublic String getShortName(); // name local to parent group();public List getVariables // list of Variables directly in this grouppublic Variable findVariable(String shortName); // find specific Variablepublic List getDimensions(); // list of Dimension directly in this grouppublic Dimension findDimension(String name); // find specific Dimensionpublic List getAttributes(); // list of Attributes directly in this grouppublic Attribute findAttribute(String name); // find specific Attributepublic Attribute findAttributeIgnoreCase(String name);public List getGroups(); // list of Groups directly in this grouppublic Group findGroup(String shortName); // find specific Grouppublic Group getParentGroup();}2.5 ucar.nc2.VariableA Variable is a multidimensional array of primitive data, Strings or Structures (a scalar variable is a rank-0 array). It has a name and a collection of dimensions and attributes, as well as logically containing the data itself. The rank of a variable is its number of dimensions, and its shape is the lengths of all of its dimensions. The dimensions are returned in getDimensions() in order of most slowly varying first (leftmost index for Java and C programmers). The data elements have type getDataType().Each Variable is contained in a Group. The full name of a variable uses "/" as separator from its parent groups, so "group1/group2/varName" names varName contained in group2 with parent group1 in the root group.public class Variable {public String getName(); // full name, starting from root grouppublic String getShortName(); // name local to parent grouppublic Group getParentGroup();public int getRank(); // rank of the arraypublic int[] getShape(); // shape of the arraypublic long getSize(); // total number of elementspublic int getElementSize(); // byte size of one elementpublic DataType getDataType(); // data type of elementspublic List getDimensions(); // get ordered list of Dimensionsnsionpublic Dime getDimension(int i); // get the ith Dimensionpublic int findDimensionIndex(String name); // find named Dimensionpublic List getAttributes(); // get list of Attributespublic Attribute findAttribute(String attName);public Attribute findAttributeIgnoreCase(String attName);public boolean isUnlimited(); // if any Dimension is unlimitedpublic boolean isSequence(); // is a Sequencepublic boolean isCoordinateVariable();// read the datapublic Array read(); // read all datapublic Array read(int[] origin, int[] shape); // read a sectionpublic Array read(List section); // list of ucar.ma2.Range objectspublic Array read(String sectionSpec); // fortran90 syntax, eg "3,0:100:10,:"// for scalar datapublic byte readScalarByte();public double readScalarDouble();public float readScalarFloat();public int readScalarInt();public long readScalarLong();public short readScalarShort();public String readScalarString();// for members of Structures : see section 2.7 belowpublic boolean isMemberOfStructure();urepublic Struct getParentStructure()(Lispublic Array readAllStructures t section, boolean flatten);public Array readAllStructuresSpec(String sectionSpec, boolean flatten);// for Variable sectionspublic boolean isSection();public Variable section(List section);public List getRanges();}Data access is handled by calling the various read methods (all of which throw IOException) which return the data in a memory-resident Array object (further manipulation can be done on the Array object, see section 5.2 below). Each read call potentially causes a disk or network access.The read() method reads all the data and returns it in a memory resident Array which has the same shape as the Variable itself.The read(int[] origin,int[] shape), read(List section), and read(String sectionSpec) methods specify a section of the Variable to read, whose returned shape is the shape of the requested section. The origin and shape parameters specify a starting index and number of elements to read, respectively, for each of the Variable's dimensions. The section parameter is a list of Range objects, one for each dimension. A null Range in the list means to use the entire shape for that dimension. A Range is constructed with a first and last (inclusive) index value, and optionally a stride. (This is the only way to do strided access)public class ucar.ma2.Range {Range(int first, int last);(intRange first, int last, int stride);int length();}The sectionSpec parameter specifies the section with a String, using Fortran 90 array section syntax. For example, "10, 1:3, :, 0:1000:100". See "Array section syntax" in section 2 for details.When the Variable is a scalar, you can use the scalar read routines; for example readScalarDouble() returns a scalar's value as a double.When the Variable is a member of an array of Structures, things are somewhat more complicated. The standard read methods operate only on the first element of the Structure array. To get data from other Structure elements, or from multiple Structure elements, you must use the readAllStructures() and related methods. See next section for details.A Variable can be created as a section of another Variable by using the section() method. A section Variable is a "first class object" that can be treated like any other Variable. If you call read( section) on a section Variable, the section parameter will refer to the new Variable's shape. Generally, a section Variable is a logical section, meaning that no data is read until a read method is called.A sequence Variable is indicated by isSequence() of true. Sequences are one dimensional arrays of any DataType whose length is not determined until the data is actually read. So getShape() and getSize() return 0. You cannot call section() or read( section) on a Sequence. IS THIS TRUE?2.6 ucar.nc2.StructureA Structure is a subclass of Variable that contains member Variables, similar to a struct in the C language.A Structure represents a multidimensional array whose elements have type DataType.STRUCTURE. A read on a Structure returns an array of StructureData objects, which contains data Arrays for the member Variables.All of a Structure's Variables' data may be assumed to be stored "close" to each other, so it may be more efficient to read all the data in one Structure at once using the Structure.read() method, rather than the read() method on its individual member Variables. This is generally true for remote access protocols like OpenDAP, since each read() call typically incurs the cost of a round-trip to a server.Both a Structure and a Group contain collections of Variables, but a Group is a logical collection, and a Structure can be considered a physical collection of data stored close together. A Group can contain shared Dimensions, but a Structure cannot. Both can contain Attributes. Most importantly, a Structure can be an array, but a Group cannot.public class Structure extends ucar.nc2.Variable {public List getVariables(); // list of Variablespublic List getVariableNames(); // list of String : members' short namespublic Variable findVariable(String shortName);public StructureData readStructure(); // for scalar datapublic StructureData readStructure(int elem); // for rank 1 datapublic Structure.Iterator getStructureIterator(); // iterator returns StructureData}public class Structure.Iterator {public boolean hasNext();public StructureData next() throws java.io.IOException;}To access the data in a structure, typically you use the read() and read(section) methods inherited from the Variable superclass. These return arrays of StructureData objects. The readStructure() and readStructure(int elem) methods can be used when the structure is scalar or one-dimensional, respectively. For any shape structure, use getStructureIterator() which returns an iterator that reads one structure in the array each time iterator.next() is called, and returns a StructureData object.public class StructureData {public List getMembers(); // StructureData.Member objectspublic java.util.List getMemberNames();public StructureData.Member findMember(String shortName);public StructureData.Member findNestedMember(String fullName);public Array findMemberArray(String memberName);// for scalar memberspublic byte getScalarByte(String memberName);public double getScalarDouble (String memberName);public float getScalarFloat(String memberName);public int getScalarInt(String memberName);public long getScalarLong(String memberName);public short getScalarShort(String memberName);public String getScalarString(String memberName); // ok for 1D char type, too}public class StructureData.Member {public ucar.nc2.Variable v;public ucar.ma2.Array data;}A StructureData object contains the data of the member variables of the structure, after the data has been read into memory with a read method. Each member variable is associated with its data Array in a StructureData.Member object. The getScalarXXX() methods are convenience methods for extracting the data when the member Variable is a scalar.Structure Member VariablesThe read methods on variables that are members of structures are complicated by the fact that the parent structure may be a non-scalar array. The member variable's read method therefore is within the context of some element of its parent structure. For this reason, a member variable is not truly a "first class" citizen. Therefore if you use the ordinary read methods on a variable with isMemberStructure() true, these will return the data only from the first structure.To read data from a member variable across multiple structures, use the member variable's readAllStructures() method. However, if you need data from more than one member variable, it is probably more efficient to call the read methods on the structure itself, and extract the member data from the StructureData object. You can use the getStructureIterator() method to access all of the data in an array of structures sequentially.If a Variable is a member of a Structure, its full name uses the "." as a separator from the Structure name, so e.g. "group1/record.varName" names varName as a member of the record Structure, which is in group1 whose parent is the root group.2.7 cdfFileA NetcdfFile provides read-only access to datasets through the netCDF API (to write data, use NetcdfFileWriteble, below). Use the static NetcdfFile.open methods to open a local netCDF (version 3 or 4) file, and most HDF5 files. See NetcdfDataset.open for more general reading capabilities, including OpenDAP and NcML.You can look at all the variables, dimensions and global/group attributes through the top level getVariables(), getDimensions(), and getGlobalAttributes() methods. Alternatively, you can explore the contained objects using groups, starting with the root group by calling getRootGroup().Generally, reading NetCDF version 3 files through the NetCDF-Java 2.2 API is backwards compatible with programs using the NetCDF-Java 2.1 API (there are a some name changes), since there are no Groups or Structures in netCDF version 3 files. However, when working with NetCDF version 4 files, HDF5 files, OpenDAP and other kinds of datasets, you will need to deal with the possible presence of Groups, Structures, Sequences, Strings, etc, that are new to the NetCDF-Java 2.2 data model.public class NetcdfFile {static NetcdfFile open(String location);s tatic NetcdfFile open(String location, String id, String title, boolean useV3, CancelTask cancel);public void close();public String getLocation(); // dataset locationpublic String getId(); // globally unique id, may be nullpublic String getTitle(); // human readable title, may be nullpublic Group getRootGroup();public List getVariables(); // all Variables in all Groupspublic Variable findVariable(String fullName); // find specific Variable by full name public Variable findTopVariable(String fullName); // no Structure member namespublic list getDimensions(); // shared Dimensionspublic Dimension findDimension(String dimName); // get specific Dimension();public List getGlobalAttributes //get list of global Attributes(String atpublic Attribute findGlobalAttribute tName); //specific Attributetepublic Attribu findGlobalAttributeIgnoreCase(String attName);public String findAttValueIgnoreCase(Variable v, String attName, String def);public Array read(String sectionSpec, boolean flatten);public void writeCDL(java.io.OutputStream os);public void writeNcML(java.io.OutputStream os);}The getVariables() method returns all Variables in all Groups, but does not include members of Structures, since those are considered to be part of the Structure Variable. Similarly, findTopVariable() only searches over these "non-nested" Variables. The findVariable() method will also look for Variables that are members of Structures, e.g. "group1/struct.member ".The findAttValueIgnoreCase() method is a convenience method for String–valued attributes which returns the specified default value if the attribute name is not found. If you specify a null for the variable then it will search for global attributes, otherwise it will search for the attribute in the given variable.The read( sectionSpec, flatten) method is a general way to read from any variable in the NetcdfFile. It accepts a String like varname(0:1,13,:).See "Array section syntax" section above for details on the syntac of the sectionSpec string. The flatten parameter is only used when the requested variable is a member of a structure.2.8 cdfFileWriteableA NetcdfFileWriteable allows a NetCDF version 3 file to be created or written to.A NetCDF file can only have dimensions, attributes and variables added to it at creation time. Thus, when a file is first opened, it is in "define mode" where these may be added. Once create() is called, the dataset structure is immutable. After create() has been called you can then write the data values. See example below.asspublic cl NetcdfFileWriteable extends NetcdfFile {public NetcdfFileWriteable(); // create new filevoidpublic setName(String filename);public setFill(boolean fill); // default falsepublic Dimension addDimension(String dimName, int dimLength);public void addGlobalAttribute(String attName, String value);public void addGlobalAttribute(String attName, Number value);public void addGlobalAttribute(String attName, Array values);// add new Variable and variable Attributespublic void addVariable(String varName, DataType varType, List dims);public void addVariableAttribute(String varName, Attribute att);// finish structure definition, create filepublic void create();。