#include <netcdfcpp.h>
Inheritance diagram for NcVar:


Public Member Functions | |
| virtual | ~NcVar (void) |
| NcToken | name (void) const |
| NcType | type (void) const |
| NcBool | is_valid (void) const |
| int | num_dims (void) const |
| NcDim * | get_dim (int) const |
| long * | edges (void) const |
| int | num_atts (void) const |
| NcAtt * | get_att (NcToken) const |
| NcAtt * | get_att (int) const |
| long | num_vals (void) const |
| NcValues * | values (void) const |
| NcBool | put (const ncbyte *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) |
| NcBool | put (const char *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) |
| NcBool | put (const short *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) |
| NcBool | put (const int *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) |
| NcBool | put (const long *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) |
| NcBool | put (const float *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) |
| NcBool | put (const double *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) |
| NcBool | put (const ncbyte *vals, const long *counts) |
| NcBool | put (const char *vals, const long *counts) |
| NcBool | put (const short *vals, const long *counts) |
| NcBool | put (const int *vals, const long *counts) |
| NcBool | put (const long *vals, const long *counts) |
| NcBool | put (const float *vals, const long *counts) |
| NcBool | put (const double *vals, const long *counts) |
| NcBool | get (ncbyte *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) const |
| NcBool | get (char *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) const |
| NcBool | get (short *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) const |
| NcBool | get (int *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) const |
| NcBool | get (long *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) const |
| NcBool | get (float *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) const |
| NcBool | get (double *vals, long c0=0, long c1=0, long c2=0, long c3=0, long c4=0) const |
| NcBool | get (ncbyte *vals, const long *counts) const |
| NcBool | get (char *vals, const long *counts) const |
| NcBool | get (short *vals, const long *counts) const |
| NcBool | get (int *vals, const long *counts) const |
| NcBool | get (long *vals, const long *counts) const |
| NcBool | get (float *vals, const long *counts) const |
| NcBool | get (double *vals, const long *counts) const |
| NcBool | set_cur (long c0=-1, long c1=-1, long c2=-1, long c3=-1, long c4=-1) |
| NcBool | set_cur (long *cur) |
| NcBool | add_att (NcToken, char) |
| NcBool | add_att (NcToken, ncbyte) |
| NcBool | add_att (NcToken, short) |
| NcBool | add_att (NcToken, int) |
| NcBool | add_att (NcToken, long) |
| NcBool | add_att (NcToken, float) |
| NcBool | add_att (NcToken, double) |
| NcBool | add_att (NcToken, const char *) |
| NcBool | add_att (NcToken, int, const char *) |
| NcBool | add_att (NcToken, int, const ncbyte *) |
| NcBool | add_att (NcToken, int, const short *) |
| NcBool | add_att (NcToken, int, const int *) |
| NcBool | add_att (NcToken, int, const long *) |
| NcBool | add_att (NcToken, int, const float *) |
| NcBool | add_att (NcToken, int, const double *) |
| NcBool | rename (NcToken newname) |
| long | rec_size (void) |
| long | rec_size (NcDim *) |
| NcValues * | get_rec (void) |
| NcValues * | get_rec (long rec) |
| NcValues * | get_rec (NcDim *d) |
| NcValues * | get_rec (NcDim *d, long slice) |
| NcBool | put_rec (const ncbyte *vals) |
| NcBool | put_rec (const char *vals) |
| NcBool | put_rec (const short *vals) |
| NcBool | put_rec (const int *vals) |
| NcBool | put_rec (const long *vals) |
| NcBool | put_rec (const float *vals) |
| NcBool | put_rec (const double *vals) |
| NcBool | put_rec (NcDim *d, const ncbyte *vals) |
| NcBool | put_rec (NcDim *d, const char *vals) |
| NcBool | put_rec (NcDim *d, const short *vals) |
| NcBool | put_rec (NcDim *d, const int *vals) |
| NcBool | put_rec (NcDim *d, const long *vals) |
| NcBool | put_rec (NcDim *d, const float *vals) |
| NcBool | put_rec (NcDim *d, const double *vals) |
| NcBool | put_rec (const ncbyte *vals, long rec) |
| NcBool | put_rec (const char *vals, long rec) |
| NcBool | put_rec (const short *vals, long rec) |
| NcBool | put_rec (const int *vals, long rec) |
| NcBool | put_rec (const long *vals, long rec) |
| NcBool | put_rec (const float *vals, long rec) |
| NcBool | put_rec (const double *vals, long rec) |
| NcBool | put_rec (NcDim *d, const ncbyte *vals, long slice) |
| NcBool | put_rec (NcDim *d, const char *vals, long slice) |
| NcBool | put_rec (NcDim *d, const short *vals, long slice) |
| NcBool | put_rec (NcDim *d, const int *vals, long slice) |
| NcBool | put_rec (NcDim *d, const long *vals, long slice) |
| NcBool | put_rec (NcDim *d, const float *vals, long slice) |
| NcBool | put_rec (NcDim *d, const double *vals, long slice) |
| long | get_index (const ncbyte *vals) |
| long | get_index (const char *vals) |
| long | get_index (const short *vals) |
| long | get_index (const int *vals) |
| long | get_index (const long *vals) |
| long | get_index (const float *vals) |
| long | get_index (const double *vals) |
| long | get_index (NcDim *d, const ncbyte *vals) |
| long | get_index (NcDim *d, const char *vals) |
| long | get_index (NcDim *d, const short *vals) |
| long | get_index (NcDim *d, const int *vals) |
| long | get_index (NcDim *d, const long *vals) |
| long | get_index (NcDim *d, const float *vals) |
| long | get_index (NcDim *d, const double *vals) |
| void | set_rec (long rec) |
| void | set_rec (NcDim *d, long slice) |
| int | id (void) const |
| NcBool | sync (void) |
Private Member Functions | |
| int | dim_to_index (NcDim *rdim) |
| NcVar (void) | |
| NcVar (NcFile *, int) | |
| int | attnum (NcToken attname) const |
| NcToken | attname (int attnum) const |
| void | init_cur (void) |
Private Attributes | |
| int | the_id |
| long * | the_cur |
| char * | the_name |
| long * | cur_rec |
Friends | |
| class | NcFile |
Definition at line 215 of file netcdfcpp.h.
|
|
Definition at line 534 of file netcdf.cpp. References cur_rec, the_cur, and the_name.
|
|
|
|
|
||||||||||||
|
Definition at line 1070 of file netcdf.cpp. References NcFile::id(), init_cur(), MAX_NC_NAME, ncBad, ncvarinq(), NcTypedComponent::the_file, the_id, and the_name. 01071 : NcTypedComponent(nc), the_id(id) 01072 { 01073 char nam[MAX_NC_NAME]; 01074 if (the_file 01075 && ncvarinq(the_file->id(), the_id, nam, 0, 0, 0, 0) != ncBad) { 01076 the_name = new char[1 + strlen(nam)]; 01077 strcpy(the_name, nam); 01078 } else { 01079 the_name = 0; 01080 } 01081 init_cur(); 01082 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
Definition at line 997 of file netcdf.cpp. References NcFile::define_mode(), FALSE, NcFile::id(), ncattput(), ncBad, ncChar, NcTypedComponent::the_file, the_id, and TRUE. 00998 { 00999 if (! the_file->define_mode()) 01000 return FALSE; 01001 if (ncattput(the_file->id(), the_id, aname, (nc_type) ncChar, 01002 strlen(val), val) == ncBad) 01003 return FALSE; 01004 return TRUE; 01005 }
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Referenced by gen(). |
|
|
Definition at line 1096 of file netcdf.cpp. References MAX_NC_NAME, ncattname(), and ncBad. Referenced by get_att(). 01097 { 01098 if (attnum < 0 || attnum >= num_atts()) 01099 return 0; 01100 char aname[MAX_NC_NAME]; 01101 if (ncattname(the_file->id(), the_id, attnum, aname) == ncBad) 01102 return 0; 01103 char* rname = new char[1 + strlen(aname)]; 01104 strcpy(rname, aname); 01105 return rname; 01106 }
|
|
|
Definition at line 1084 of file netcdf.cpp. References NcFile::id(), MAX_NC_NAME, ncattname(), num_atts(), NcTypedComponent::the_file, and the_id. 01085 { 01086 int num; 01087 for(num=0; num < num_atts(); num++) { 01088 char aname[MAX_NC_NAME]; 01089 ncattname(the_file->id(), the_id, num, aname); 01090 if (strcmp(aname, attrname) == 0) 01091 break; 01092 } 01093 return num; // num_atts() if no such attribute 01094 }
|
|
|
Definition at line 638 of file netcdf.cpp. References get_dim(), NcDim::name(), name(), and num_dims(). Referenced by get_rec(), rec_size(), and set_rec(). 00639 { 00640 for (int i=0; i < num_dims() ; i++) { 00641 if (strcmp(get_dim(i)->name(),rdim->name()) == 0) { 00642 return i; 00643 } 00644 } 00645 // we should fail and gripe about it here.... 00646 return -1; 00647 }
|
|
|
Definition at line 576 of file netcdf.cpp. References get_dim(), num_dims(), and NcDim::size(). Referenced by get_rec(), and rec_size(). 00577 { 00578 long* evec = new long[num_dims()]; 00579 for(int i=0; i < num_dims(); i++) 00580 evec[i] = get_dim(i)->size(); 00581 return evec; 00582 }
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
|
Definition at line 605 of file netcdf.cpp. References attname(), get_att(), and num_atts(). 00606 { 00607 if (n < 0 || n >= num_atts()) 00608 return 0; 00609 NcToken aname = attname(n); 00610 NcAtt* ap = get_att(aname); 00611 delete [] (char*)aname; 00612 return ap; 00613 }
|
|
|
Definition at line 595 of file netcdf.cpp. References NcAtt::is_valid(), and NcTypedComponent::the_file. Referenced by dumpatts(), get_att(), and NcFile::get_att(). 00596 { 00597 NcAtt* att = new NcAtt(the_file, this, aname); 00598 if (! att->is_valid()) { 00599 delete att; 00600 return 0; 00601 } 00602 return att; 00603 }
|
|
|
Definition at line 566 of file netcdf.cpp. References NcFile::get_dim(), NcFile::id(), MAX_NC_DIMS, ncBad, ncvarinq(), NcTypedComponent::the_file, and the_id. Referenced by dim_to_index(), DumpableNcFile::dumpvars(), edges(), get_rec(), num_vals(), set_cur(), set_rec(), and values(). 00567 { 00568 int ndim; 00569 int dims[MAX_NC_DIMS]; 00570 if(ncvarinq(the_file->id(), the_id, 0, 0, &ndim, dims, 0) == ncBad || 00571 i < 0 || i >= ndim) 00572 return 0; 00573 return the_file->get_dim(dims[i]); 00574 }
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 677 of file netcdf.cpp. References NcValues::base(), dim_to_index(), edges(), NcTypedComponent::get_space(), NcFile::id(), ncBad, ncvarget(), num_dims(), rec_size(), set_cur(), size, NcTypedComponent::the_file, and the_id. 00678 { 00679 int idx = dim_to_index(rdim); 00680 long size = num_dims(); 00681 long* start = new long[size]; 00682 for (int i=1; i < size ; i++) start[i] = 0; 00683 start[idx] = slice; 00684 NcBool result = set_cur(start); 00685 if (! result ) { 00686 delete [] start; 00687 return 0; 00688 } 00689 00690 long* edge = edges(); 00691 edge[idx] = 1; 00692 NcValues* valp = get_space(rec_size(rdim)); 00693 if (ncvarget(the_file->id(), the_id, start, edge, valp->base()) == ncBad) { 00694 delete [] start; 00695 delete [] edge; 00696 delete valp; 00697 return 0; 00698 } 00699 delete [] start; 00700 delete [] edge; 00701 return valp; 00702 }
|
|
|
|
|
|
Definition at line 672 of file netcdf.cpp. References get_dim(), and get_rec().
|
|
|
Definition at line 667 of file netcdf.cpp. References cur_rec, and get_dim(). Referenced by get_rec().
|
|
|
Definition at line 1040 of file netcdf.cpp. References the_id. Referenced by NcAtt::is_valid(), NcAtt::num_vals(), NcAtt::remove(), NcAtt::rename(), NcAtt::type(), and NcAtt::values(). 01041 { 01042 return the_id; 01043 }
|
|
|
Definition at line 1108 of file netcdf.cpp. References cur_rec, MAX_NC_DIMS, and the_cur. Referenced by NcVar(), and sync(). 01109 { 01110 the_cur = new long[MAX_NC_DIMS]; // *** don't know num_dims() yet? 01111 cur_rec = new long[MAX_NC_DIMS]; // *** don't know num_dims() yet? 01112 for(int i = 0; i < MAX_NC_DIMS; i++) { 01113 the_cur[i] = 0; cur_rec[i] = 0; } 01114 }
|
|
|
Implements NcTypedComponent. Definition at line 553 of file netcdf.cpp. References NcFile::is_valid(), ncBad, NcTypedComponent::the_file, and the_id. Referenced by NcAtt::is_valid().
|
|
|
Implements NcTypedComponent. Definition at line 541 of file netcdf.cpp. References the_name. Referenced by dim_to_index(), dumpatts(), DumpableNcFile::dumpdata(), and DumpableNcFile::dumpvars(). 00542 { 00543 return the_name; 00544 }
|
|
|
Definition at line 584 of file netcdf.cpp. References NcFile::id(), NcFile::is_valid(), ncGlobal, ncvarinq(), NcFile::num_atts(), NcTypedComponent::the_file, and the_id. Referenced by attnum(), and get_att(). 00585 { 00586 int natt = 0; 00587 if (the_file->is_valid()) 00588 if (the_id == ncGlobal) 00589 natt = the_file->num_atts(); 00590 else 00591 ncvarinq(the_file->id(), the_id, 0, 0, 0, 0, &natt); 00592 return natt; 00593 }
|
|
|
Definition at line 558 of file netcdf.cpp. References NcFile::id(), ncvarinq(), NcTypedComponent::the_file, and the_id. Referenced by dim_to_index(), DumpableNcFile::dumpvars(), edges(), get_rec(), num_vals(), rec_size(), set_cur(), and values(). 00559 { 00560 int ndim; 00561 ncvarinq(the_file->id(), the_id, 0, 0, &ndim, 0, 0); 00562 return ndim; 00563 }
|
|
|
Implements NcTypedComponent. Definition at line 615 of file netcdf.cpp. References get_dim(), num_dims(), and NcDim::size(). 00616 { 00617 long prod = 1; 00618 for (int d = 0; d < num_dims(); d++) 00619 prod *= get_dim(d)->size(); 00620 return prod; 00621 }
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
Referenced by gen(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 755 of file netcdf.cpp. References dim_to_index(), edges(), num_dims(), and size. 00755 { 00756 int idx = dim_to_index(rdim); 00757 long size = 1; 00758 long* edge = edges(); 00759 for( int i = 0 ; i<num_dims() ; i++) { 00760 if (i != idx) { 00761 size *= edge[i]; 00762 } 00763 } 00764 delete [] edge; 00765 return size; 00766 }
|
|
|
Referenced by get_rec(). |
|
|
Implements NcTypedComponent. |
|
|
Definition at line 958 of file netcdf.cpp. References FALSE, get_dim(), num_dims(), size, the_cur, and TRUE. 00959 { 00960 for(int i = 0; i < num_dims(); i++) { 00961 if (cur[i] >= get_dim(i)->size() && ! get_dim(i)->is_unlimited()) 00962 return FALSE; 00963 the_cur[i] = cur[i]; 00964 } 00965 return TRUE; 00966 }
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||
|
Definition at line 649 of file netcdf.cpp. References cur_rec, dim_to_index(), get_dim(), and size. 00650 { 00651 int i = dim_to_index(rdim); 00652 // we should fail and gripe about it here.... 00653 if (slice >= get_dim(i)->size() && ! get_dim(i)->is_unlimited()) 00654 return; 00655 cur_rec[i] = slice; 00656 return; 00657 }
|
|
|
Definition at line 659 of file netcdf.cpp. References get_dim(). 00660 { 00661 // Since we can't ask for the record dimension here 00662 // just assume [0] is it..... 00663 set_rec(get_dim(0),rec); 00664 return; 00665 }
|
|
|
Definition at line 1045 of file netcdf.cpp. References cur_rec, FALSE, NcFile::id(), init_cur(), MAX_NC_NAME, ncBad, ncvarinq(), the_cur, NcTypedComponent::the_file, the_id, the_name, and TRUE. Referenced by NcFile::sync(). 01046 { 01047 if (the_name) { 01048 delete [] the_name; 01049 } 01050 if (the_cur) { 01051 delete [] the_cur; 01052 } 01053 if (cur_rec) { 01054 delete [] cur_rec; 01055 } 01056 char nam[MAX_NC_NAME]; 01057 if (the_file 01058 && ncvarinq(the_file->id(), the_id, nam, 0, 0, 0, 0) != ncBad) { 01059 the_name = new char[1 + strlen(nam)]; 01060 strcpy(the_name, nam); 01061 } else { 01062 the_name = 0; 01063 return FALSE; 01064 } 01065 init_cur(); 01066 return TRUE; 01067 }
|
|
|
Implements NcTypedComponent. Definition at line 546 of file netcdf.cpp. References NcFile::id(), ncvarinq(), NcTypedComponent::the_file, and the_id. Referenced by DumpableNcFile::dumpvars(). 00547 { 00548 nc_type typ; 00549 ncvarinq(the_file->id(), the_id, 0, &typ, 0, 0, 0); 00550 return (NcType) typ; 00551 }
|
|
|
Implements NcTypedComponent. Definition at line 623 of file netcdf.cpp. References NcValues::base(), get_dim(), NcTypedComponent::get_space(), NcFile::id(), MAX_NC_DIMS, ncBad, ncvarget(), ndims, num_dims(), NcDim::size(), NcTypedComponent::the_file, and the_id. Referenced by DumpableNcFile::dumpdata(). 00624 { 00625 int ndims = num_dims(); 00626 long crnr[MAX_NC_DIMS]; 00627 long edgs[MAX_NC_DIMS]; 00628 for (int i = 0; i < ndims; i++) { 00629 crnr[i] = 0; 00630 edgs[i] = get_dim(i)->size(); 00631 } 00632 NcValues* valp = get_space(); 00633 if (ncvarget(the_file->id(), the_id, crnr, edgs, valp->base()) == ncBad) 00634 return 0; 00635 return valp; 00636 }
|
|
|
Definition at line 403 of file netcdfcpp.h. |
|
|
Definition at line 392 of file netcdfcpp.h. Referenced by get_rec(), init_cur(), set_rec(), sync(), and ~NcVar(). |
|
|
Definition at line 390 of file netcdfcpp.h. Referenced by init_cur(), set_cur(), sync(), and ~NcVar(). |
|
|
Definition at line 389 of file netcdfcpp.h. Referenced by add_att(), attnum(), get_dim(), get_rec(), id(), is_valid(), NcVar(), num_atts(), num_dims(), sync(), type(), and values(). |
|
|
Definition at line 391 of file netcdfcpp.h. |
1.4.4