@@ -304,31 +304,11 @@ bool ParseNetCDFRunInfoFile(CModel *&pModel, optStruct &Options, bool runname_ov
304304 att_value=s_to_d (my_value);
305305 delete my_value;
306306
307- cout<<" RUN INFO NAMED CONSTANT = " <<name<<" value = " <<att_value <<endl;
307+ // cout<<"RUN INFO NAMED CONSTANT = "<<name<<" value = "<<att_value <<endl;
308308 if (Options.management_optimization ){
309309 pModel->GetManagementOptimizer ()->AddUserConstant (name,att_value);
310310 }
311311 }
312-
313- // TargetStageSet_ ----------------------------------------------------
314-
315- if (att_name_s.substr (0 , 15 ) == " TargetStageSet_" ) {
316- string SBID_s=att_name_s.substr (15 ,att_name_s.length ());
317- long long SBID=s_to_ll (SBID_s.c_str ());
318-
319- retval = nc_inq_attlen (ncid, varid_props, att_name, &att_len);
320- char * boolean = new char [att_len + 1 ];
321- retval = nc_get_att_text (ncid,varid_props,att_name,boolean); HandleNetCDFErrors (retval);// read attribute text
322- boolean[att_len] = ' \0 ' ;// add string determining character
323-
324- if (!strcmp (boolean," true" )) {
325-
326- // LOOK for User Time Series
327- // pModel->GetManagementOptimizer()->LookForTargetStageInUserTS(SBID);
328- // creates !hSBID = @ts("TargetStage_SBID",0) management goal , ensures units correction applied
329- ExitGracefully (" RUN INFO FILE - TARGET STAGE SET " ,STUB);
330- }
331- }
332312 }
333313 }
334314 }
@@ -716,112 +696,6 @@ bool ParseNetCDFFlowStateFile(CModel*& pModel,const optStruct& Options)
716696#endif
717697}
718698
719- // ////////////////////////////////////////////////////////////////
720- // / \brief Parses Deltares FEWS Management Time series file
721- // /
722- // / \param *&pModel [out] Reference to model object
723- // / \param &Options [out] Global model options information
724- // / \return True if operation is successful
725- //
726- // The management update file includes:
727- // 1) 'time' dimensions
728- // 2) One or more vectors of size[1:time]
729-
730- // .The state variable corresponding to the model start time will be used for initialization of flow/stage; all other values in the time vector are ignored
731- // The naming convention of each vector is : {UserTimeSeries_NAME}
732- //
733- bool ParseNetCDFManagementFile (CModel*& pModel,const optStruct& Options)
734- {
735- if (Options.maninfo_filename ==" " ) { return true ; }
736- if (!Options.management_optimization )
737- {
738- WriteWarning (" :FEWSManagmentInfoFile command will be ignored; Management optimization is not enabled." ,Options.noisy );
739- return true ;
740- }
741-
742- #ifdef _RVNETCDF_
743- int ncid; // NetCDF file id
744- int retval; // return value of NetCDF routines
745- int ntime = 0 ; // size of time vector
746- int time_dimid; // dimension id of time variable
747- int start_time_index=0 ; // index of NetCDF time array which corresponds to Raven start time
748-
749- // Open file
750- // ====================================================================
751- string manfile=Options.maninfo_filename ;
752-
753- if (Options.noisy ) { cout<<" Opening management info file " <<manfile<<endl; }
754- retval = nc_open (manfile.c_str (),NC_NOWRITE,&ncid);
755- if (retval != 0 ) {
756- string warn = " ParseNetCDFManagementFile: :ParseNetCDFManagementFile command: Cannot find file " + manfile;
757- ExitGracefully (warn.c_str (),BAD_DATA_WARN);
758- return false ;
759- }
760- HandleNetCDFErrors (retval);
761-
762- // Get information from time vector
763- // ====================================================================
764- GetNetCDFTimeInfo (ncid,time_dimid,ntime,start_time_index,Options);
765-
766- if ((start_time_index < 0 ) || (start_time_index >= ntime))
767- {
768- time_struct tt;
769- JulianConvert (0 , Options.julian_start_day , Options.julian_start_year , Options.calendar , tt);
770- string warn = " ParseNetCDFFlowStateFile: Model start time (" +tt.date_string +" " + DecDaysToHours (Options.julian_start_day )+" ) does not occur during time window provided in NetCDF state update file" ;
771- ExitGracefully (warn.c_str (), BAD_DATA);
772- return false ;
773- }
774-
775- // Get Names of all UserTimeSeries_ vectors in model
776- // ====================================================================
777- int N=0 ;
778- string *userTSnames;
779- int nvars;
780- char varname[NC_MAX_NAME];
781- retval=nc_inq_nvars (ncid,&nvars);
782-
783- userTSnames=new string [nvars];
784-
785- for (int i = 0 ; i < nvars; i++) {
786- retval=nc_inq_varname (ncid,i,varname);
787-
788- userTSnames[N]=varname;
789-
790- if (userTSnames[N].substr (0 ,15 )==" UserTimeSeries_" )
791- {
792- userTSnames[N]=userTSnames[N].substr (15 ,userTSnames[N].length ());
793- N++;
794- }
795- }
796-
797- // close file
798- // ====================================================================
799- retval = nc_close (ncid); HandleNetCDFErrors (retval);
800-
801- // Read data and store as time series
802- // ====================================================================
803-
804- CTimeSeries *pTS;
805- for (int i=0 ;i<N;i++)
806- {
807- pTS=CTimeSeries::ReadTimeSeriesFromNetCDF (Options, userTSnames[i],
808- DOESNT_EXIST, " none" ,false , true , // assumes period ending format
809- manfile, " UserTimeSeries_" +userTSnames[i],
810- " None" , " time" , // this assumes "time" is FEWS standard for time dimension
811- 0 , 0.0 , 1.0 , 0.0 );
812- if (Options.management_optimization ){
813- cout<<" ADDING USER TIME SERIES " <<endl;
814- pModel->GetManagementOptimizer ()->AddUserTimeSeries (pTS);
815- }
816- }
817- delete [] userTSnames;
818-
819- return true ;
820- #else
821- ExitGracefully (" ParseNetCDFFlowStateFile: Deltares FEWS State Update file can only be read using NetCDF version of Raven" ,BAD_DATA_WARN);
822- return false ;
823- #endif
824- }
825699
826700// ////////////////////////////////////////////////////////////////
827701// / \brief Parses Deltares FEWS Parameter update file
0 commit comments