Utilities for netCDF-4 Dr. Dennis Heimbigner Unidata Advanced netCDF Workshop July 25, 2011.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

Core Java Lecture 4-5. What We Will Cover Today What Are Methods Scope and Life Time of Variables Command Line Arguments Use of static keyword in Java.
PL/SQL.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
The Future of NetCDF Russ Rew UCAR Unidata Program Center Acknowledgments: John Caron, Ed Hartnett, NASA’s Earth Science Technology Office, National Science.
Loops – While, Do, For Repetition Statements Introduction to Arrays
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
Chapter 8. 2 Objectives You should be able to describe: One-Dimensional Arrays Array Initialization Arrays as Arguments Two-Dimensional Arrays Common.
1 Chapter 2 Introductory Programs. 2 Getting started To create and run a Java program –Create a text file with a.java extension for the source code. For.
C++ for Engineers and Scientists Third Edition
Guide To UNIX Using Linux Third Edition
Review of C++ Programming Part II Sheng-Fang Huang.
Lecture 18 Last Lecture Today’s Topic Instruction formats
PHP: Introduction By Trevor Adams.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Chapter 7: Arrays. In this chapter, you will learn about: One-dimensional arrays Array initialization Declaring and processing two-dimensional arrays.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Chapter 4: The Selection Process in Visual Basic.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
CH2 – Using Data. Constant Something which cannot be changed Data Type Format and size of a data item Intrinsic Data Types Pg. 47 – Table 2-1 Basic ones.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
Data Management Interface (DMI) Enhancements Overview Bill Oakley.
The netCDF-4 data model and format Russ Rew, UCAR Unidata NetCDF Workshop 25 October 2012.
What is an Array? An array is a collection of variables. Arrays have three important properties: –group of related items(for example, temperature for.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Integrating netCDF and OPeNDAP (The DrNO Project) Dr. Dennis Heimbigner Unidata Go-ESSP Workshop Seattle, WA, Sept
Structures in C++ UNIVERSITY OF THE PUNJAB (GUJRANWALA CAMPUS) 1 ADNAN BABAR MT14028 CR.
Accessing Remote Datasets using the DAP protocol through the netCDF interface. Dr. Dennis Heimbigner Unidata netCDF Workshop August 3-4, 2009.
Advanced Utilities Extending ncgen to support the netCDF-4 Data Model Dr. Dennis Heimbigner Unidata netCDF Workshop August 3-4, 2009.
M180: Data Structures & Algorithms in Java Arrays in Java Arab Open University 1.
4.4 JavaScript (JS) Deitel Ch. 7, 8, 9, JavaScript & Java: Similarities JS (JavaScript) is case-sensitive Operators –arithmetic: unary +, unary.
NetCDF Data Model Issues Russ Rew, UCAR Unidata NetCDF 2010 Workshop
BY A Mikati & M Shaito Awk Utility n Introduction n Some basics n Some samples n Patterns & Actions Regular Expressions n Boolean n start /end n.
Introduction to Programming
ISBN Chapter 6 Data Types Introduction Primitive Data Types User-Defined Ordinal Types.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 13 File Input and.
Programming Fundamentals. Today’s Lecture The Conditional Operator Logical Operators Structures Enumerations.
A First Book of C++: From Here To There, Third Edition2 Objectives You should be able to describe: One-Dimensional Arrays Array Initialization Arrays.
CompMathBSc, English 5 October 2006 Programming basics — continued  Arrays  Cycle Statements: Loops  Control Structures vs Conditions  Subs: Procedures.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Programming with Microsoft Visual Basic th Edition
CSI 3125, Preliminaries, page 1 Data Type, Variables.
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
Functions, Scope, and The Free Store Functions Functions must be declared by a function prototype before they are invoked, return_type Function_name(type,
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
Arrays What is an array… –A data structure that holds a set of homogenous elements (of the same type) –Associate a set of numbers with a single variable.
Department of Electronic & Electrical Engineering Lecture 3 IO reading and writing variables scanf printf format strings "%d %c %f" Expressions operators.
NetCDF Data Model Details Russ Rew, UCAR Unidata NetCDF 2009 Workshop
Objectives You should be able to describe: One-Dimensional Arrays
LESSON 8: INTRODUCTION TO ARRAYS. Lesson 8: Introduction To Arrays Objectives: Write programs that handle collections of similar items. Declare array.
A FIRST BOOK OF C++ CHAPTER 7 ARRAYS. OBJECTIVES In this chapter, you will learn about: One-Dimensional Arrays Array Initialization Arrays as Arguments.
The purpose of a CPU is to process data Custom written software is created for a user to meet exact purpose Off the shelf software is developed by a software.
ARRAYS (Extra slides) Arrays are objects that help us organize large amounts of information.
DAP+NETCDF Using the netCDF-4 Data Model
JAVA MULTIPLE CHOICE QUESTION.
Moving from HDF4 to HDF5/netCDF-4
NetCDF 3.6: What’s New Russ Rew
Object Oriented Programming
Extending the NetCDF Supported Data Formats using a Dispatch Layer
Other Kinds of Arrays Chapter 11
Other Kinds of Arrays Chapter 11
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Unidata Advanced netCDF Workshop
Chapter 3 Introduction to Classes, Objects Methods and Strings
PHP.
Remote Data Access Update
Arrays .
Presentation transcript:

Utilities for netCDF-4 Dr. Dennis Heimbigner Unidata Advanced netCDF Workshop July 25, 2011

Overview Extending CDL to support netCDF-4 Model netCDF4 in CDL: Types netCDF4 in CDL: Typed Attributes netCDF4 in CDL: Groups Scope Rules Specifying Data Constants Special Attributes NCGEN for netCDF4 NCGEN Command Synopsis Extended Example

Extending CDL to Support netCDF-4 Model ncdump and ncgen both support CDL extended to cover the netCDF-4 model. CDL now has the following new elements:  Extended set of atomic types  User defined types  Typed Attributes  Groups  Special attributes Extended Example

netCDF4 in CDL: Types Supports the new atomic data types: ubyte, ushort, uint, string, int64, uint64 New section called “types:” for user-defined types  int enum enum_t {t=0,f=1,other=2};  opaque(11) opaque_t;  compound cmpd_t { int64 f1; enum_t f2;};  int(*) vlen_t;

netCDF4 in CDL: Typed Attributes vlen_t v:attr = {17, 18, 19}; Attribute typing is optional (=> type inferred) Warning! x:attr = “abc”; is inferred to be type char, not string  Instead say string x:attr = “abc”;  Why? for backward compatibility with ncgen3 Good practice to add “_t” to the end of all type names Why? Because e.g. X :attr = … is ambiguous  Is X a type for a global attribute or a variable?

netCDF4 in CDL: Groups Syntax: group: g {…} [Note the colon] A group can itself contain types, dimensions, variables, and (nested) groups Name prefixing allows references to types and dimensions that reside in other groups Example: /g/cmpd_t => Do not use ‘/’ in your names Pretty much like the Unix file system  Or Windows, but using forward slashes

Scope Rules Scope rules determine how references to a dimension or type without a prefix are interpreted General rule: 1.Look in immediately enclosing group 2.Look in the parent of the immediately enclosing group and so on up the enclosing groups For dimensions, if not found => error For types, continue to search the whole file to find a unique match, then error if not found

Specifying Data Constants Constants for user defined types require the use of braces {…} in certain places. dimensions: d=2; types: int(*) vlen_t; compound cmpd_t { int64 f1; string f2;}; variables: vlen_t v1(d); cmpd_t v2(d); data: v1 = {7, 8, 9}, {17,18,19, 20, 21}; v2 = {107, “abc”}, { , “xyz”};

Rules for Using Braces The top level is automatically assumed to be a list of items, so it should not be inside {...} ( Different than C constants lists). UNLIMITED dimension instances (other than the outer dimension) must be surrounded by {...} in order to specify the size. Vlen instances must be surrounded by {...} in order to specify the size. Compound instances must be embedded in {...} Non-scalar fields of compound instances must be embedded in {...}. Datalists associated with attributes are implicitly a vector (i.e., a list) of values of the type of the attribute and the above rules must apply with that in mind. No other use of braces is allowed (esp. for arrays)

Special Attributes Special attributes specified in an ncgen CDL file will be properly handled Consistent with ncdump -s Global special attributes  “_Format” – specify the netCDF file format “classic” (equivalent to –k1) “64-bit offset” (-k2) “netCDF-4” (-k3) “netCDF-4 classic model” (-k4)  _Format is overridden by command line -k flag

Special Attributes (cont.) Per-variable special attributes _Storage – constant string “contiguous” or “chunked” to set storage mode _ChunkSizes – 1-d array of integer chunk sizes;1 per dimension _DeflateLevel – (integer range 0-9) compression level _Endianness – constant strings “big” or “little” _Fletcher32 – boolean to set check summing _NoFill – boolean sets persistent NoFill property _Shuffle – boolean to enable/disable shuffle filter Note: boolean value can be “true”, “1”, “false”, or “0”

NCGEN Command Synopsis Primary Command Line Option Extensions [-k ] Format of the file to be created 1 => classic 32 bit 2 => classic 64 bit 3 => netcdf-4/CDM 4 => classic, but stored in netcdf-4 file format [-l ] Currently C (full netcdf-4 support); Java, F77 (netcdf-3 only); default => binary output with full netcdf-4 support Input CDL file

Extended Example An extended example is included in the ncgen man page

Questions?

Debugging Note Use the “Cycle” Use ncgen to convert your.cdl to.nc Then use ncdump to convert your.nc to.cdl Compare.cdl to.cdl Watch out for UNLIMITED! CDL: dimensions: u = unlimited; variables: v1(u); v2(u); data: v1 = {1,2,3,4}; v2 = {7,8}; Ncdump produces v2 = {7,8,_,_};