University-of-Reading-Space-Science / HUXt

HUXt - a lightweight solar wind model.
MIT License
41 stars 16 forks source link

Error in ConeCME_from_params #10

Closed VallesMarinerisExplorer closed 1 year ago

VallesMarinerisExplorer commented 1 year ago

Hi all and thanks for this great repo!

I found a possible bug when trying to do example 19. Not sure if this is easily solvable.

t_cme is not fully defined in this function in huxt_inputs.py:

def ConeCME_from_params(model, v, lon, lat, width, obstime, obsheight): """ A function to produce a ConeCME for input to HUXt derived from supplied CME params. Args: model: A HUXt instance. v: CME speed, in kms/s lon: CME longitude in HEEQ, in deg lat: CME latitude in HEEQ, in deg width: CME full width, in deg obstime: Time of reference coronagraph observation obsheight: Height of reference coronagraph observation, in rS returns: cme: A ConeCME instances. """

figure out the time of the CME at the model inner boundary, assuming constant speed

dr = (model.r[0] - obsheight).to(u.km)
dt = (dr/v).to(u.day)
#t_cme = obstime + 

# CME initialisation relative to model initialisation, in days
dt_cme = (t_cme - model.time_init).jd * u.day
radius = np.abs(model.r[0] * np.tan(width / 2.0)) 
LukeBarnard commented 1 year ago

Hi @VallesMarinerisExplorer. Thanks for spotting this - I think you are correct. This was a function that was being written in the development version, but then was not needed. It should have been deleted and not pushed into the latest release. None of the examples or other HUXt functions depend on this function, and so I'll delete this and publish a minor update. Thanks again!

LukeBarnard commented 1 year ago

This has now been fixed in v.4.0.3