Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WeatherSampler does not work when Weather is enabled #9338

Open
BrianCollinss opened this issue Sep 24, 2024 · 8 comments
Open

WeatherSampler does not work when Weather is enabled #9338

BrianCollinss opened this issue Sep 24, 2024 · 8 comments
Assignees
Labels

Comments

@BrianCollinss
Copy link
Member

What happened?

  • When I have both WeatherSampler and Weather enabled, the sims are not random and always depend on the Weather's met file.
  • When Weather is disabled, I get all sorts of errors as many underlying processes rely on Weather. For example:

Unable to evaluate linear interpolation function .Simulation.Field.Maize.Leaf.FrostFraction --> Error while locating variable '[Weather].MinT' in variable reference '.Simulation.Field.Maize.Leaf.FrostFraction.XValue' --> Unable to find any model with name or type Weather in scope of XValue

What Operating System are you on?

Windows

@ric394
Copy link
Contributor

ric394 commented Sep 25, 2024

From my limited understanding of WeatherSampler it's main usage is related to Simulation spin up.
Are you trying to do something similar?

@BrianCollinss
Copy link
Member Author

BrianCollinss commented Sep 25, 2024

I am studying it for the first time as we're thinking of building a new weather-related model. I added it next to Weather and expected to see different results each time I run the sims, but it didn't happen as Weather data was always used instead. Perhaps I'm using it wrongly.

@sno036
Copy link
Contributor

sno036 commented Sep 26, 2024

@BrianCollinss - WeatherSampler is instead of Weather not as well as. So this is expected behaviour - although it might be better if it threw a fatal error if both were in the simulation.

@BrianCollinss
Copy link
Member Author

Thanks @sno036 but when I remove weather, it throws as Maize, for example, calls it.

@hol353
Copy link
Contributor

hol353 commented Sep 26, 2024

The problem is that lots of models in APSIM look for a model called 'Weather'. They shouldn't, but they do.

The workaround might be to remove Weather and rename WeatherSampler to weather in the GUI.

On this PR (#9326) I talk about wanting to refactor the messy weather components. One day...

@BrianCollinss
Copy link
Member Author

Thanks @hol353. What do you recommend models do if they need access to daily weather data?

@hol353
Copy link
Contributor

hol353 commented Sep 27, 2024

They should [Link] to IWeather, rather than [Weather]. This way, it doesn't matter what the name or type of the weather model is, just that it implements an IWeather interface. A lot of models already do this, but as you've discovered, not all.

@rcichota
Copy link
Contributor

I also noticed that WeatherSampler does not have all the outputs that Weather has (this may add to the errors you're having). I will try finishing that pull request ensuring that both models have the same variables (and defaults). Refactoring might need a bit more time/focus.

@ric394 ric394 moved this from Backlog to In progress in Apsim Initiative Software Bugs Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In progress
Development

No branches or pull requests

5 participants