Changeset 816 for XIOS/trunk/src/io/nc4_data_output.cpp
- Timestamp:
- 01/26/16 18:19:04 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/io/nc4_data_output.cpp
r802 r816 639 639 { 640 640 SuperClassWriter::addDimension(axisid, zoom_size); 641 dims.push_back(axisid); 642 SuperClassWriter::addVariable(axisid, NC_FLOAT, dims); 643 644 if (!axis->name.isEmpty()) 645 SuperClassWriter::addAttribute("name", axis->name.getValue(), &axisid); 646 647 if (!axis->standard_name.isEmpty()) 648 SuperClassWriter::addAttribute("standard_name", axis->standard_name.getValue(), &axisid); 649 650 if (!axis->long_name.isEmpty()) 651 SuperClassWriter::addAttribute("long_name", axis->long_name.getValue(), &axisid); 652 653 if (!axis->unit.isEmpty()) 654 SuperClassWriter::addAttribute("units", axis->unit.getValue(), &axisid); 655 656 if (!axis->positive.isEmpty()) 641 if (axis->hasValue) 657 642 { 658 SuperClassWriter::addAttribute("axis", string("Z"), &axisid); 659 SuperClassWriter::addAttribute("positive", 660 (axis->positive == CAxis::positive_attr::up) ? string("up") : string("down"), 661 &axisid); 662 } 663 664 StdString axisBoundsId = axisid + "_bounds"; 665 if (!axis->bounds.isEmpty()) 666 { 667 dims.push_back("axis_nbounds"); 668 SuperClassWriter::addVariable(axisBoundsId, NC_FLOAT, dims); 669 SuperClassWriter::addAttribute("bounds", axisBoundsId, &axisid); 670 } 671 672 SuperClassWriter::definition_end(); 673 switch (SuperClass::type) 674 { 675 case MULTI_FILE: 643 dims.push_back(axisid); 644 SuperClassWriter::addVariable(axisid, NC_FLOAT, dims); 645 646 if (!axis->name.isEmpty()) 647 SuperClassWriter::addAttribute("name", axis->name.getValue(), &axisid); 648 649 if (!axis->standard_name.isEmpty()) 650 SuperClassWriter::addAttribute("standard_name", axis->standard_name.getValue(), &axisid); 651 652 if (!axis->long_name.isEmpty()) 653 SuperClassWriter::addAttribute("long_name", axis->long_name.getValue(), &axisid); 654 655 if (!axis->unit.isEmpty()) 656 SuperClassWriter::addAttribute("units", axis->unit.getValue(), &axisid); 657 658 if (!axis->positive.isEmpty()) 676 659 { 677 CArray<double,1> axis_value(zoom_size_srv); 678 for (int i = 0; i < zoom_size_srv; i++) axis_value(i) = axis->value_srv(i); 679 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0); 680 681 if (!axis->bounds.isEmpty()) 682 SuperClassWriter::writeData(axis->bound_srv, axisBoundsId, isCollective, 0); 683 684 SuperClassWriter::definition_start(); 685 686 break; 660 SuperClassWriter::addAttribute("axis", string("Z"), &axisid); 661 SuperClassWriter::addAttribute("positive", 662 (axis->positive == CAxis::positive_attr::up) ? string("up") : string("down"), 663 &axisid); 687 664 } 688 case ONE_FILE: 665 666 StdString axisBoundsId = axisid + "_bounds"; 667 if (!axis->bounds.isEmpty()) 689 668 { 690 CArray<double,1> axis_value(zoom_size_srv); 691 axis_value = axis->value_srv; 692 693 std::vector<StdSize> start(1), startBounds(2) ; 694 std::vector<StdSize> count(1), countBounds(2) ; 695 start[0] = startBounds[0] = zoom_begin_srv-axis->global_zoom_begin; 696 count[0] = countBounds[0] = zoom_size_srv; 697 startBounds[1] = 0; 698 countBounds[1] = 2; 699 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count); 700 701 if (!axis->bounds.isEmpty()) 702 SuperClassWriter::writeData(axis->bound_srv, axisBoundsId, isCollective, 0, &startBounds, &countBounds); 703 704 SuperClassWriter::definition_start(); 705 706 break; 669 dims.push_back("axis_nbounds"); 670 SuperClassWriter::addVariable(axisBoundsId, NC_FLOAT, dims); 671 SuperClassWriter::addAttribute("bounds", axisBoundsId, &axisid); 707 672 } 708 default : 709 ERROR("CNc4DataOutput::writeDomain(domain)", 710 << "[ type = " << SuperClass::type << "]" 711 << " not implemented yet !"); 673 674 SuperClassWriter::definition_end(); 675 676 switch (SuperClass::type) 677 { 678 case MULTI_FILE: 679 { 680 CArray<double,1> axis_value(zoom_size_srv); 681 for (int i = 0; i < zoom_size_srv; i++) axis_value(i) = axis->value_srv(i); 682 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0); 683 684 if (!axis->bounds.isEmpty()) 685 SuperClassWriter::writeData(axis->bound_srv, axisBoundsId, isCollective, 0); 686 687 SuperClassWriter::definition_start(); 688 689 break; 690 } 691 case ONE_FILE: 692 { 693 CArray<double,1> axis_value(zoom_size_srv); 694 axis_value = axis->value_srv; 695 696 std::vector<StdSize> start(1), startBounds(2) ; 697 std::vector<StdSize> count(1), countBounds(2) ; 698 start[0] = startBounds[0] = zoom_begin_srv-axis->global_zoom_begin; 699 count[0] = countBounds[0] = zoom_size_srv; 700 startBounds[1] = 0; 701 countBounds[1] = 2; 702 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count); 703 704 if (!axis->bounds.isEmpty()) 705 SuperClassWriter::writeData(axis->bound_srv, axisBoundsId, isCollective, 0, &startBounds, &countBounds); 706 707 SuperClassWriter::definition_start(); 708 709 break; 710 } 711 default : 712 ERROR("CNc4DataOutput::writeAxis_(CAxis* axis)", 713 << "[ type = " << SuperClass::type << "]" 714 << " not implemented yet !"); 715 } 712 716 } 713 717 }
Note: See TracChangeset
for help on using the changeset viewer.