Skip to content

Commit

Permalink
Fixed #2276 - Add support for deriving zonal and meridional winds for…
Browse files Browse the repository at this point in the history
… MPAS model outputs (#2290)

* Fixed #2276

* Fixed memory leak

* Check return code
  • Loading branch information
clyne authored May 19, 2020
1 parent 77f5869 commit 8a1fef8
Show file tree
Hide file tree
Showing 2 changed files with 330 additions and 19 deletions.
69 changes: 66 additions & 3 deletions include/vapor/DCMPAS.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,6 @@ class VDF_API DCMPAS : public VAPoR::DC {
bool _isCoordVar(string varname) const;
bool _isDataVar(string varname) const;

template <class T>
int _getVar(size_t ts, string varname, T *buf);

int _read_nEdgesOnCell(size_t ts);
void _addMissingFlag(int *data) const;
int _readVarToSmartBuf(
Expand Down Expand Up @@ -362,6 +359,72 @@ class VDF_API DCMPAS : public VAPoR::DC {
};



// Derive Uzonal and Umeridional data variable
//
class DerivedZonalMeridonal : public DerivedDataVar {
public:
DerivedZonalMeridonal(
string derivedVarName, DC *dc, NetCDFCollection *ncdfc,
string normalVarName, string tangentialVarName, bool zonalFlag
);

int Initialize();

bool GetBaseVarInfo(
DC::BaseVar &var
) const;

bool GetDataVarInfo(
DC::DataVar &cvar
) const;

virtual std::vector <string> GetInputs() const {
return(std::vector <string> {_normalVarName, _tangentialVarName});
}


int GetDimLensAtLevel(
int , std::vector <size_t> &dims_at_level,
std::vector <size_t> &bs_at_level
) const;

int OpenVariableRead(
size_t ts, int , int
);

int CloseVariable(int fd);


int ReadRegionBlock(
int fd,
const vector <size_t> &min, const vector <size_t> &max, float *region
) {
return(ReadRegion(fd, min, max, region));
}

int ReadRegion(
int fd,
const vector <size_t> &min, const vector <size_t> &max, float *region
);

bool VariableExists(
size_t ts,
int ,
int
) const;

private:
DC *_dc;
NetCDFCollection *_ncdfc;
string _normalVarName;
string _tangentialVarName;
bool _zonalFlag;
DC::DataVar _dataVarInfo;

};


};
};

Expand Down
Loading

0 comments on commit 8a1fef8

Please sign in to comment.