XMLIOSERVER 0.4
Serveur d'Entrées/Sorties parallèles
|
00001 /* ************************************************************************** * 00002 * Copyright © IPSL/LSCE, XMLIOServer, Avril 2010 - Octobre 2011 * 00003 * ************************************************************************** */ 00004 00005 #ifndef __INETCDF4_ADV_IMPL_H__ 00006 #define __INETCDF4_ADV_IMPL_H__ 00007 00016 // /////////////////////////////// Définitions ////////////////////////////// // 00017 00018 namespace xmlioserver { 00019 namespace io { 00020 00021 template <class DataType> 00022 void CINetCDF4Adv::getMissingValue(DataType & _value, const std::string & _varname) 00023 { 00024 std::vector<DataType> value; 00025 if (this->hasAttribute("missing_value", &_varname)) 00026 { 00027 this->readAttribute("missing_value", value, &_varname); 00028 _value = value[0]; 00029 } 00030 if (this->hasAttribute("_FillValue", &_varname)) 00031 { 00032 this->readAttribute("_FillValue", value, &_varname); 00033 _value = value[0]; 00034 } 00035 } 00036 00037 template <class DataType, std::size_t ndim> 00038 bool CINetCDF4Adv::replaceMissingValue(const std::string & _varname, 00039 boost::multi_array<DataType, ndim> & _data, 00040 const DataType & newValue) 00041 { 00042 if (this->hasMissingValue(_varname)) 00043 { 00044 DataType mvalue; 00045 this->CINetCDF4Adv::getMissingValue(mvalue, _varname); 00046 std::replace(_data.begin(), _data.end(), mvalue, newValue); 00047 return (true); 00048 } 00049 return (false); 00050 } 00051 00052 } // namespace io 00053 } // namespace xmlioserver 00054 00055 #endif // __INETCDF4_ADV_IMPL_H__ 00056