Changeset 464 for XIOS/trunk/src/output/nc4_data_output.cpp
- Timestamp:
- 01/21/14 15:28:59 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/output/nc4_data_output.cpp
r463 r464 566 566 // bool isCurvilinear = domain->isCurvilinear ; 567 567 568 nc_type type = (!field->prec.isEmpty() && 569 ( field->prec.getValue() == 4)) 570 ? NC_FLOAT : NC_DOUBLE; 568 nc_type type ; 569 if (field->prec.isEmpty()) type = NC_FLOAT ; 570 else 571 { 572 if (field->prec==2) type = NC_SHORT ; 573 else if (field->prec==4) type = NC_FLOAT ; 574 else if (field->prec==8) type = NC_DOUBLE ; 575 } 576 571 577 bool wtime = !(!field->operation.isEmpty() && field->foperation->timeType() == func::CFunctor::once); 572 578 … … 628 634 SuperClassWriter::addAttribute 629 635 ("valid_max", field->valid_max.getValue(), &fieldid); 636 637 if (!field->scale_factor.isEmpty()) 638 SuperClassWriter::addAttribute 639 ("scale_factor", field->scale_factor.getValue(), &fieldid); 640 641 if (!field->add_offset.isEmpty()) 642 SuperClassWriter::addAttribute 643 ("add_offset", field->add_offset.getValue(), &fieldid); 630 644 631 645 SuperClassWriter::addAttribute … … 765 779 if (server->intraCommRank==0) isRoot=true ; 766 780 else isRoot=false ; 767 781 782 if (!field->scale_factor.isEmpty() || !field->add_offset.isEmpty()) 783 { 784 double scaleFactor=1. ; 785 double addOffset=0. ; 786 if (!field->scale_factor.isEmpty()) scaleFactor=field->scale_factor ; 787 if (!field->add_offset.isEmpty()) addOffset=field->add_offset ; 788 field->scaleFactorAddOffset(scaleFactor,addOffset) ; 789 } 790 768 791 if (grid->hasAxis()) // 3D 769 792 { … … 771 794 CArray<double,3> field_data3D(domain->zoom_ni_srv,domain->zoom_nj_srv,axis->zoom_size) ; 772 795 if (!field->default_value.isEmpty()) field_data3D = field->default_value ; 796 773 797 field->outputField(field_data3D); 798 799 if (field->prec==2) field_data3D=round(field_data3D) ; 800 774 801 switch (SuperClass::type) 775 802 { … … 815 842 if (!field->default_value.isEmpty()) field_data2D = field->default_value ; 816 843 field->outputField(field_data2D); 844 if (field->prec==2) field_data2D=round(field_data2D) ; 817 845 switch (SuperClass::type) 818 846 {
Note: See TracChangeset
for help on using the changeset viewer.