Changeset 1430
- Timestamp:
- 02/16/18 16:32:08 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/config/axis_attribute.conf
r1266 r1430 11 11 DECLARE_ATTRIBUTE(int, n_glo) 12 12 DECLARE_ENUM2(positive, up, down) 13 DECLARE_ENUM4(axis_type, X, Y, Z, T) 14 15 DECLARE_ATTRIBUTE(StdString, dim_name) 13 16 14 17 /* GLOBAL */ -
XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute.conf
r1391 r1430 5 5 DECLARE_ATTRIBUTE(StdString , lon_name) 6 6 DECLARE_ATTRIBUTE(StdString , lat_name) 7 DECLARE_ATTRIBUTE(StdString , bounds_lon_name) 8 DECLARE_ATTRIBUTE(StdString , bounds_lat_name) 9 DECLARE_ATTRIBUTE(StdString , dim_i_name) 10 DECLARE_ATTRIBUTE(StdString , dim_j_name) 7 11 8 12 /* GLOBAL */ -
XIOS/dev/XIOS_DEV_CMIP6/src/config/scalar_attribute.conf
r1158 r1430 7 7 /* LOCAL and GLOBAL*/ 8 8 DECLARE_ATTRIBUTE(double, value) 9 DECLARE_ATTRIBUTE(StdString, bounds_value_name) 10 DECLARE_ATTRIBUTE(double, bounds_value) 9 11 10 12 DECLARE_ATTRIBUTE(StdString, scalar_ref) 11 13 DECLARE_ATTRIBUTE(int, prec) 14 15 DECLARE_ENUM4(axis_type, X, Y, Z, T) -
XIOS/dev/XIOS_DEV_CMIP6/src/io/inetcdf4.cpp
r948 r1430 502 502 { 503 503 std::map<StdString, StdSize> dimvar = this->getDimensions(&coord, path); 504 if ((dimvar.size() == 1) && (dimvar.find(coord) != dimvar.end())) 504 // if ((dimvar.size() == 1) && (dimvar.find(coord) != dimvar.end())) 505 if ((dimvar.size() == 1) ) 505 506 continue; 506 507 else -
XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp
r1428 r1430 185 185 */ 186 186 for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it) 187 listDimSize.push_front(*dimSizeMap.find(*it)); 187 { 188 // It is not required any more for dimension name and lon/lat names to be the same (aka lon(lon)) 189 if (SuperClassWriter::isRectilinear(fieldId)) 190 { 191 StdString lonName = SuperClassWriter::getLonCoordName(fieldId); 192 StdString latName = SuperClassWriter::getLatCoordName(fieldId); 193 StdString dimLonName = SuperClassWriter::getDimensions(&lonName).begin()->first; 194 StdString dimLatName = SuperClassWriter::getDimensions(&latName).begin()->first; 195 if ((lonName != dimLonName) && (*it == dimLonName)) 196 { 197 StdSize dimSizeTmp = dimSizeMap.find(*it)->second; 198 listDimSize.push_front(make_pair(lonName, dimSizeTmp)); 199 } 200 else if ((latName != dimLatName) && (*it == dimLatName)) 201 { 202 StdSize dimSizeTmp = dimSizeMap.find(*it)->second; 203 listDimSize.push_front(make_pair(latName, dimSizeTmp)); 204 } 205 else 206 listDimSize.push_front(*dimSizeMap.find(*it)); 207 } 208 else 209 listDimSize.push_front(*dimSizeMap.find(*it)); 210 211 } 188 212 189 213 // Now process domain and axis -
XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp
r1424 r1430 103 103 else latName = domain->lat_name; 104 104 105 dimXid = StdString("x").append(appendDomid); 106 dimYid = StdString("y").append(appendDomid); 105 if (domain->dim_i_name.isEmpty()) dimXid=StdString("x").append(appendDomid); 106 else dimXid=domain->dim_i_name.getValue() + appendDomid; 107 108 if (domain->dim_j_name.isEmpty()) dimYid=StdString("y").append(appendDomid); 109 else dimYid=domain->dim_j_name.getValue() + appendDomid; 110 107 111 break ; 108 112 109 113 case CDomain::type_attr::rectilinear : 110 114 111 if (domain->lon_name.isEmpty()) lonName = "lon"; 115 if (domain->lon_name.isEmpty()) 116 { 117 if (domain->dim_i_name.isEmpty()) 118 lonName = "lon"; 119 else 120 lonName = domain->dim_i_name.getValue(); 121 } 112 122 else lonName = domain->lon_name; 113 123 114 if (domain->lat_name.isEmpty()) latName = "lat"; 124 if (domain->lat_name.isEmpty()) 125 { 126 if (domain->dim_j_name.isEmpty()) 127 latName = "lat"; 128 else 129 latName = domain->dim_j_name.getValue(); 130 } 115 131 else latName = domain->lat_name; 116 132 117 dimXid = lonName+appendDomid; 118 dimYid = latName+appendDomid; 133 if (domain->dim_i_name.isEmpty()) dimXid = lonName+appendDomid; 134 else dimXid = domain->dim_i_name.getValue()+appendDomid; 135 136 if (domain->dim_j_name.isEmpty()) dimYid = latName+appendDomid; 137 else dimYid = domain->dim_j_name.getValue()+appendDomid; 119 138 break; 120 139 } … … 222 241 break; 223 242 } 224 225 bounds_lonid = "bounds_"+lonName+appendDomid; 226 bounds_latid = "bounds_"+latName+appendDomid; 243 if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; 244 else bounds_lonid = "bounds_"+lonName+appendDomid; 245 if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; 246 else bounds_latid = "bounds_"+latName+appendDomid; 227 247 228 248 SuperClassWriter::addDimension(dimXid, domain->zoom_ni); … … 370 390 break; 371 391 } 372 373 bounds_lonid = "bounds_"+lonName+appendDomid; 374 bounds_latid = "bounds_"+latName+appendDomid; 392 if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; 393 else bounds_lonid = "bounds_"+lonName+appendDomid; 394 if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; 395 else bounds_latid = "bounds_"+latName+appendDomid; 375 396 376 397 this->writeAxisAttributes … … 951 972 StdString appendDomid = (singleDomain) ? "" : "_"+domid ; 952 973 953 StdString lonName,latName ;974 StdString lonName,latName, cellName ; 954 975 if (domain->lon_name.isEmpty()) lonName = "lon"; 955 976 else lonName = domain->lon_name; … … 958 979 else latName = domain->lat_name; 959 980 960 StdString dimXid = StdString("cell").append(appendDomid); 981 if (!domain->dim_i_name.isEmpty()) cellName=domain->dim_i_name; 982 else cellName="cell"; 983 StdString dimXid = cellName+appendDomid; 961 984 StdString dimVertId = StdString("nvertex").append(appendDomid); 962 985 … … 1044 1067 lonid = lonName+appendDomid; 1045 1068 latid = latName+appendDomid; 1046 bounds_lonid = "bounds_"+lonName+appendDomid; 1047 bounds_latid = "bounds_"+latName+appendDomid; 1069 if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; 1070 else bounds_lonid = "bounds_"+lonName+appendDomid; 1071 if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; 1072 else bounds_latid = "bounds_"+latName+appendDomid; 1073 1048 1074 if (domain->hasLonLat) 1049 1075 { … … 1098 1124 lonid = lonName+appendDomid; 1099 1125 latid = latName+appendDomid; 1100 bounds_lonid = "bounds_"+lonName+appendDomid; 1101 bounds_latid = "bounds_"+latName+appendDomid; 1126 if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name; 1127 else bounds_lonid = "bounds_"+lonName+appendDomid; 1128 if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name; 1129 else bounds_latid = "bounds_"+latName+appendDomid; 1102 1130 1103 1131 dim0.push_back(dimXid); … … 1213 1241 std::vector<StdString> dims; 1214 1242 StdString axisid = axis->getAxisOutputName(); 1243 StdString axisDim; 1215 1244 if (isWrittenAxis(axisid)) return ; 1216 1245 else setWrittenAxis(axisid); … … 1225 1254 try 1226 1255 { 1227 SuperClassWriter::addDimension(axisid, zoom_size);1228 1256 if (!axis->label.isEmpty()) SuperClassWriter::addDimension(strId, stringArrayLen); 1229 1257 if (axis->hasValue) 1230 1258 { 1231 dims.push_back(axisid); 1259 if (axis->dim_name.isEmpty()) axisDim = axisid; 1260 else axisDim=axis->dim_name.getValue(); 1261 1262 SuperClassWriter::addDimension(axisDim, zoom_size); 1263 dims.push_back(axisDim); 1264 1232 1265 if (!axis->label.isEmpty()) dims.push_back(strId); 1266 1233 1267 SuperClassWriter::addVariable(axisid, typePrec, dims); 1234 1268 … … 1245 1279 SuperClassWriter::addAttribute("units", axis->unit.getValue(), &axisid); 1246 1280 1281 if (!axis->axis_type.isEmpty()) 1282 { 1283 switch(axis->axis_type) 1284 { 1285 case CAxis::axis_type_attr::X : 1286 SuperClassWriter::addAttribute("axis", string("X"), &axisid); 1287 break; 1288 case CAxis::axis_type_attr::Y : 1289 SuperClassWriter::addAttribute("axis", string("Y"), &axisid); 1290 break; 1291 case CAxis::axis_type_attr::Z : 1292 SuperClassWriter::addAttribute("axis", string("Z"), &axisid); 1293 break; 1294 case CAxis::axis_type_attr::T : 1295 SuperClassWriter::addAttribute("axis", string("T"), &axisid); 1296 break; 1297 } 1298 } 1299 1247 1300 if (!axis->positive.isEmpty()) 1248 1301 { 1249 SuperClassWriter::addAttribute("axis", string("Z"), &axisid);1250 1302 SuperClassWriter::addAttribute("positive", 1251 1303 (axis->positive == CAxis::positive_attr::up) ? string("up") : string("down"), … … 1278 1330 SuperClassWriter::addAttribute("formula_term", axis->formula_term_bounds.getValue(), &axisBoundsId); 1279 1331 } 1280 1281 1332 1282 1333 SuperClassWriter::definition_end(); … … 1413 1464 1414 1465 StdString scalaId = scalar->getScalarOutputName(); 1466 StdString boundsId; 1415 1467 if (isWrittenAxis(scalaId)) return ; 1416 1468 else setWrittenAxis(scalaId); … … 1421 1473 else if (scalar->prec==8) typePrec = NC_DOUBLE ; 1422 1474 1423 1424 1475 try 1425 1476 { 1426 1477 if (!scalar->value.isEmpty()) 1427 1478 { 1479 std::vector<StdString> dims; 1428 1480 // dims.push_back(scalaId); 1429 std::vector<StdString> dims; 1481 StdString scalarDim = scalaId; 1482 1430 1483 SuperClassWriter::addVariable(scalaId, typePrec, dims); 1431 1484 … … 1441 1494 if (!scalar->unit.isEmpty()) 1442 1495 SuperClassWriter::addAttribute("units", scalar->unit.getValue(), &scalaId); 1496 1497 if (!scalar->axis_type.isEmpty()) 1498 { 1499 switch(scalar->axis_type) 1500 { 1501 case CScalar::axis_type_attr::X : 1502 SuperClassWriter::addAttribute("axis", string("X"), &scalaId); 1503 break; 1504 case CScalar::axis_type_attr::Y : 1505 SuperClassWriter::addAttribute("axis", string("Y"), &scalaId); 1506 break; 1507 case CScalar::axis_type_attr::Z : 1508 SuperClassWriter::addAttribute("axis", string("Z"), &scalaId); 1509 break; 1510 case CScalar::axis_type_attr::T : 1511 SuperClassWriter::addAttribute("axis", string("T"), &scalaId); 1512 break; 1513 } 1514 } 1515 1516 if (!scalar->bounds_value.isEmpty()) 1517 { 1518 if (!scalar->bounds_value_name.isEmpty()) 1519 { 1520 boundsId = scalar->bounds_value_name.getValue(); 1521 SuperClassWriter::addAttribute("bounds_value_name", boundsId, &scalaId); 1522 } 1523 SuperClassWriter::addDimension(boundsId, 1); 1524 SuperClassWriter::addVariable(boundsId, typePrec, dims); 1525 } 1443 1526 1444 1527 SuperClassWriter::definition_end(); … … 1451 1534 scalarValue(0) = scalar->value; 1452 1535 SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0); 1536 if (!scalar->bounds_value.isEmpty()) 1537 { 1538 scalarValue(0) = scalar->bounds_value; 1539 SuperClassWriter::writeData(scalarValue, boundsId, isCollective, 0); 1540 } 1453 1541 SuperClassWriter::definition_start(); 1454 1542 … … 1465 1553 count[0] = 1; 1466 1554 SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0, &start, &count); 1555 if (!scalar->bounds_value.isEmpty()) 1556 { 1557 scalarValue(0) = scalar->bounds_value; 1558 SuperClassWriter::writeData(scalarValue, boundsId, isCollective, 0, &start, &count); 1559 } 1467 1560 SuperClassWriter::definition_start(); 1468 1561 … … 1533 1626 break; 1534 1627 case CDomain::type_attr::unstructured: 1535 compress << "cell" << appendDomId; 1628 StdString cellName = (!domain->dim_i_name.isEmpty()) ? cellName=domain->dim_i_name : "cell"; 1629 compress << cellName << appendDomId; 1630 // compress << "cell" << appendDomId; 1536 1631 break; 1537 1632 } … … 1759 1854 StdString appendDomId = singleDomain ? "" : "_" + domId ; 1760 1855 StdString lonName,latName ; 1856 StdString dimIname,dimJname ; 1761 1857 1762 1858 if (domain->lon_name.isEmpty()) … … 1773 1869 } 1774 1870 else latName = domain->lat_name; 1871 1872 if (domain->dim_i_name.isEmpty()) 1873 { 1874 if (domain->type==CDomain::type_attr::curvilinear) dimIname = "x"; 1875 else if (domain->type==CDomain::type_attr::unstructured) dimIname = "cell"; 1876 else dimIname = lonName; 1877 } 1878 else dimIname = domain->dim_i_name; 1879 1880 if (domain->dim_j_name.isEmpty()) 1881 { 1882 if (domain->type==CDomain::type_attr::curvilinear) dimJname = "y"; 1883 else dimJname = latName; 1884 } 1885 else dimJname = domain->dim_j_name; 1775 1886 1776 1887 if (compressedOutput && domain->isCompressible() && domain->type != CDomain::type_attr::unstructured) … … 1785 1896 if (!compressedOutput || !domain->isCompressible()) 1786 1897 { 1787 dimXid = StdString("x").append(appendDomId); 1898 dimXid=dimIname+appendDomId; 1899 dimYid=dimJname+appendDomId; 1788 1900 dimIdList.push_back(dimXid); 1789 dimYid = StdString("y").append(appendDomId);1790 1901 dimIdList.push_back(dimYid); 1791 1902 } … … 1796 1907 if (!compressedOutput || !domain->isCompressible()) 1797 1908 { 1798 dimXid = lonName+appendDomId; 1909 dimXid = dimIname+appendDomId; 1910 dimYid = dimJname+appendDomId; 1799 1911 dimIdList.push_back(dimXid); 1800 dimYid = latName+appendDomId;1801 1912 dimIdList.push_back(dimYid); 1802 1913 } 1914 if (lonName != dimIname) dimCoordList.push_back(lonName+appendDomId); 1915 if (latName != dimJname) dimCoordList.push_back(latName+appendDomId); 1916 1803 1917 break ; 1804 1918 case CDomain::type_attr::unstructured: … … 1806 1920 if (SuperClassWriter::useCFConvention) 1807 1921 { 1808 dimXid = StdString("cell").append(appendDomId);1922 dimXid = dimIname + appendDomId; 1809 1923 dimIdList.push_back(dimXid); 1810 1924 dimCoordList.push_back(lonName+appendDomId); … … 1850 1964 CAxis* axis = CAxis::get(axisList[idxAxis]); 1851 1965 StdString axisId = axis->getAxisOutputName(); 1966 StdString axisDim; 1967 1968 if (axis->dim_name.isEmpty()) axisDim = axisId; 1969 else axisDim=axis->dim_name.getValue(); 1852 1970 1853 1971 if (compressedOutput && axis->isCompressible()) 1854 1972 { 1855 dimIdList.push_back(axis Id+ "_points");1973 dimIdList.push_back(axisDim + "_points"); 1856 1974 field->setUseCompressedOutput(); 1857 1975 } 1858 1976 else 1859 dimIdList.push_back(axis Id);1860 1861 dimCoordList.push_back(axisId);1977 dimIdList.push_back(axisDim); 1978 1979 if (axisDim != axisId) dimCoordList.push_back(axisId); 1862 1980 ++idxAxis; 1863 1981 } 1864 else // scalar1982 else 1865 1983 { 1866 /* Do nothing here */ 1984 CScalar* scalar = CScalar::get(scalarList[idxScalar]); 1985 StdString scalarId = scalar->getScalarOutputName(); 1986 dimCoordList.push_back(scalarId); 1987 ++idxScalar; 1867 1988 } 1868 1989 }
Note: See TracChangeset
for help on using the changeset viewer.