Beispiel #1
0
void FileNetcdf::writeGlobalAttributes() {
   if(getGlobalAttribute("Conventions") != "")
      setGlobalAttribute("Conventions", "CF-1.0");
   std::stringstream ss;
   ss << Util::getCurrentTimeStamp() << ": post-processing by gridpp";
   prependGlobalAttribute("history", ss.str());
}
	/**
	 * @param attribute
	 * @return
	 */
	Attribute CDFFileReader::getGlobalAttribute(const std::string& attribute)
	{
		//first, check if the attribute has already been requested. If so, return stored value
		boost::unordered_map<std::string, Attribute>::iterator iter = gAttributes.find(attribute);
		if (iter != gAttributes.end())
			return (*iter).second;

		//std::cout << "after search in getGlobalAttribute(const std::string& attribute" << std::endl;

		//cout << "attribute: " << attribute;
		long attrNum = getGlobalAttributeID(attribute);
		//cout << "attrNum after attribute: " << attrNum << endl;
		Attribute current_attribute;
		if (attrNum < 0)
		{
			//std::cout << "attrNum: " << attrNum << " returned for " << attribute << std::endl;
		}
		else
		{
			current_attribute = getGlobalAttribute(attrNum);
		}//gAttributes[attribute] = current_attribute;
		return current_attribute;
	}