Hi,

Wow, that is old code, 2.x vintage. Things have moved on somewhat, you code 
will have had an archive database name as archive_database in your skin 
config (recall 2.x and earlier had two databases; an archive database and a 
stats database. 3.x and later has a singe database). The accepted way know 
to specify a source of archive data is to provide a binding name (as 
defined in weewx.conf [DataBindings], wx_binding is the default and most 
likely what you want. If your image generator class has derived itself from 
imagegenerator.ImageGenerator then your generator will have everything it 
needs to know to access that binding, if not then you really need to change 
that or you will likely run into a number of other 2.x/3.x 
issues/differences. lastGoodStamp is unchanged as long as you have a db 
manager from your binding there is no change needed there.

getSqlVectorsExtended has disappeared, there is not just getSqlVectors 
though it should work just fine for you though with a slightly different 
signature and returning two time vectors.

I would try something like this (untested of course):

binding = plot_options.get('binding', 'wx_binding')
archivedb = self.db_binder.get_manager(binding)
plotgen_ts = archivedb.lastGoodStamp()
plot_tspan = weeutil.weeutil.TimeSpan(minstamp, maxstamp)
(time_vec_t_ws,  time_stop_vec_t_ws, data_windSpeed)   = archivedb.
getSqlVectors(plot_tspan, 'windSpeed', aggregate_interval=aggregate_interval
)

Note the above relies on you now using a config option 'binding' in your 
skin config file to specify the binding to be used (or you an leave it out 
to default to wx_binding):

binding = some_binding_name

You will find much of what you need code wise in bin/weewx/manager.py and 
bin/weewx/imagegenerator.py.

Gary


On Sunday, 26 January 2020 05:20:42 UTC+10, Brent Dowell wrote:
>
> So, I'm upgrading my old windrose imageGenerator and I've been able to 
> force it to actually generate images, but I'm not sure what to look at on 
> how to get the data for it.
>
> It looks like there are 3 functions that I need to really update to how 
> things are done now, but I'm not sure where to look?
>
> Basically what I'm looking for is something that gives the the 2 arrays 
> like the getSqlVectorsExtended used to return.
>
> 1)     archivedb = self._getArchive(plot_options['archive_database'])
> 2)     plotgen_ts = archivedb.lastGoodStamp()
> 3)     (time_vec_t_ws,  data_windSpeed)   = 
> archivedb.getSqlVectorsExtended('windSpeed',   minstamp, maxstamp, 
> aggregate_interval, 'windSpeed')
>
> If someone can point me to what I should be looking for in the new code, 
> that would be great! 
>
> Thanks!
>
> Brent
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/6a810c7f-acef-495e-a952-b6203e6e0c2e%40googlegroups.com.

Reply via email to