00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "config.h"
00022 #include <vector>
00023 #include <string>
00024 #include <cstdio>
00025 #ifdef HAVE_NETCDFCPP_H
00026 #include <netcdfcpp.h>
00027 #endif
00028
00029 typedef std::vector<float> subscripts;
00030 typedef std::vector<subscripts> worklist;
00031 typedef std::vector<std::string> namelist;
00032 typedef std::vector<int> indexlist;
00033 typedef std::vector<indexlist> workindexlist;
00034
00035 int read_work(FILE *stream, worklist &work, namelist &names);
00036 int write_work(FILE *stream, const worklist &work, const namelist &names);
00037 long workamount(const worklist& work,int idx=0);
00038 bool tol_eq(float a, float b);
00039
00040
00041 workindexlist fill_index_list(const worklist & work, const namelist &names, const worklist &workdone, const namelist& namesdone);
00042
00043 void dumpwork(const worklist &work, const namelist &names);
00044
00045 #ifdef HAVE_NETCDFCPP_H
00046
00047 int read_structureAny(const NcFile &file, worklist &work, namelist &names,const char* varname);
00048
00049
00050 inline int read_structure(const NcFile &file, worklist &work, namelist &names) {
00051 return read_structureAny(file, work, names,"ems");
00052 };
00053
00054
00055
00056 int write_structure(NcFile &file, worklist &work, namelist &names);
00057
00058
00059 int write_vars_values(NcFile &file, worklist &work);
00060
00061
00062 int write_var_values(NcFile &file, std::string varname, float start, float end, subscripts& subscr);
00063
00064
00065 int write_gvar_values(NcFile &file, std::string varname, subscripts& subscr);
00066
00067
00068
00069 void copyvar(NcVar &varold, NcVar &varnew, const workindexlist& idx, int level, indexlist& cidxold, indexlist &cidxnew);
00070
00071
00072 void copyvar(FILE *stream, NcVar &varnew, const workindexlist& idx, int level, indexlist &cidxnew);
00073
00074
00075
00076
00077 NcFile *doubledim(NcFile &fileold, const std::string &filepath, const std::string &name, worklist &newwork);
00078 #endif