Skip to content

Example 5 not working - misaligned dimensions #2

Description

@landky

Example 5 doesn't run. I haven't changed any of the provided dependency or marginal fit files.

2025-05-08 10:14:54.575 | INFO     | marinetools.temporal.simulation:simulation:89 - Simulation no. 0001 of 0005
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[4], [line 1](vscode-notebook-cell:?execution_count=4&line=1)
----> [1](vscode-notebook-cell:?execution_count=4&line=1) simulation.simulation(params)

File C:\checkouts\branches\python\klandon\In-progress\marinetools-main\src\marinetools\temporal\simulation.py:318, in simulation(param, tidalConstituents, dur_storm_calms, seed, include)
    [310](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:310) df["n"] = (
    [311](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:311)     (df.index.dayofyear + df.index.hour / 24.0 - 1)
    [312](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:312)     / pd.to_datetime(
    [313](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:313)         {"year": df.index.year, "month": 12, "day": 31, "hour": 23}
    [314](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:314)     ).dt.dayofyear
    [315](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:315) ).values
    [317](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:317) # Create the stationary full simulation
--> [318](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:318) zsim = var_simulation(param["TD"], len(df), "normal")
    [320](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:320) for ind_, var_ in enumerate(param["TD"]["vars"]):
    [321](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:321)     # Compute the inverse of the Gaussian PM
    [322](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:322)     dfj = pd.DataFrame(
    [323](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:323)         st.norm.cdf(zsim[:, ind_]), index=df.index, columns=["prob"]
    [324](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:324)     )

File C:\checkouts\branches\python\klandon\In-progress\marinetools-main\src\marinetools\temporal\simulation.py:527, in var_simulation(par, lsim, distribution)
    [525](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:525)     z = np.fliplr(zsim[:, i - ord_ : i])
    [526](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:526)     z1 = np.vstack((1, np.reshape(z.T, (ord_ * dim, 1))))
--> [527](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:527)     zsim[:, i] = np.dot(par["B"], z1).T + y[:, i]
    [529](file:///C:/checkouts/branches/python/klandon/In-progress/marinetools-main/src/marinetools/temporal/simulation.py:529) return zsim.T

File <__array_function__ internals>:200, in dot(*args, **kwargs)

ValueError: shapes (2,117) and (115,1) not aligned: 117 (dim 1) != 115 (dim 0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions