Jump to content

Saving grids as pictures


Recommended Posts

Hi HPJ,


If it's an actual script running inside WAsP, then you have a ReportingAssistant object in context, which you can get to help with this kind of thing.


Look at the standard WAsP report called "Resource Grid Report (HTML).was9". You'll see lines like this:


ReportingAssistant.Illustrator.Width = 5000
ReportingAssistant.Illustrator.DrawResourceGridResultInMap(ImageFilename, VectorMap, ResultMap.Map, VariableIndex, , False)


Getting all the objects you need is fairly complicated, but once you have them, the illustrator can generate an image file for you.


The variable index is a selector to describe which result you are drawing from the resource grid. There is an enum for this index, with the prefix "ergm", for example "ergmMeanSpeed"


The result map is arrived at thus (in this report script)....:


Set VariableResult = ResourceGrid2.Results.PredictedClimateResults.ResultByID(VariableIndex)


This code gets the currently selected resource grid reference. Then the results of this, and from the PWC part, selects the results for a particular variable selector.


Set ResultMap = ReportingAssistant.TypeCaster.CastObjectToResourceGridResultMap(VariableResult.OmniDirectionalResultMap)


This code gets the all-sector result map for the result and typecasts it into the right type of object for the illustrator.


ResultMap is a resource grid result map wrapper object with meta-data. To get the actual results map, you need to refer to ResultMap.Map (sorry that's confusing!), so that's what gets passed in to the illustrator.


So, Hans Peter, the answer to your question is 'Yes'. But I'm afraid it's not perfectly straightforward. The complexity is largely due to the fact that a resource grid object is has lots of information and may be in many different states.


Hope that helps, Duncan.
Link to comment
  • 1 month later...
Thanks Duncan.

There's no question this will come in handy at some point, but... I should, of course, have specified in more detail, the grids I was thinking of. I was hoping to export the wind grid maps from WEng. That is, for instance, the friction velociy grid or the terrain inclination grid.

If I can't export them as images, perhaps they can be exported as grid files in some 'easy' way ;-)

Thanks again,
Hans Peter
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...