/** @file SofieZTMerge.cpp @author Brian Magill @creationdate 8/16/2006 $Date:$ $Revision:$ @copyright (©) Copyright 2006 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @brief Merges the data of two ZT_Profile objects into one. This class is tailored specifically for SOFIE. At the moment it is hardwired at a 5 km spacing. */ //#include "ZT_Profile.h" #include "SofieZTMerge.h" #include #include #include using namespace std; //ZT_Profile SofieZTMerge::operator()(ZT_Profile const & ncepProf, ZT_Profile const & msisProf) ZT_Profile SofieZTMerge::operator()(ZT_Profile & ncepProf, ZT_Profile & msisProf) { vector alt; vector temperature; unsigned long i; double z=0; ZT_Profile newProfile; // const unsigned long STRICTLY_NCEP = 40; // const double StartNCEPAlt = 0.0; // const double GridSpacing = 1.0; // const unsigned long MERGE_REGION = 20; // const double StartMergeAlt = GridSpacing*STRICTLY_NCEP + StartNCEPAlt; // const unsigned long STRICTLY_MSIS = 81; // const double StartMSISAlt = GridSpacing*MERGE_REGION + StartMergeAlt; // vector w(MERGE_REGION); // double incr = 1.0/static_cast(MERGE_REGION); // double x; assert(msisProf.MinAlt() <= ncepProf.MaxAlt() ); double x = msisProf(ncepProf.MaxAlt())- ncepProf(ncepProf.MaxAlt()); while( z <= ncepProf.MaxAlt() ) { alt.push_back(z); temperature.push_back(ncepProf(z) ); z += 1.0; } while( z <= msisProf.MaxAlt() ) { alt.push_back(z); temperature.push_back(msisProf(z)-x ); z += 1.0; } /* for(i = 0; i < MERGE_REGION; i++) { w.push_back(i*incr); } for(i = 0; i < STRICTLY_NCEP; i++) { z = GridSpacing*i + StartNCEPAlt; alt.push_back(z); x = ncepProf(z); temperature.push_back(x ); } for(i = 0; i < MERGE_REGION; i++) { z = GridSpacing*i + StartMergeAlt; alt.push_back(z); temperature.push_back(ncepProf(z)*(1 - w[i]) + msisProf(z)*w[i]); } for(i = 0; i < STRICTLY_MSIS; i++) { z = GridSpacing*i + StartMSISAlt; alt.push_back(z); temperature.push_back(msisProf(z) ); } std::cout << ncepProf.MinAlt() << " " << ncepProf.MaxAlt() << std::endl; std::cout << msisProf.MinAlt() << " " << msisProf.MaxAlt() << std::endl; std::cout << msisProf(ncepProf.MaxAlt() ) << " " << ncepProf( ncepProf.MaxAlt() ) << std::endl; exit(23); std::cout << "inside merge " << std::endl; for(i=0; i< alt.size(); ++i) std::cout << temperature[i] << " " << alt[i] << std::endl; exit(23); */ newProfile = ZT_Profile(alt, temperature); return newProfile; }