Skip to content

Convert *.asc file to *.dfs2 #602

Answered by RenewAndPlay
RenewAndPlay asked this question in Q&A
Discussion options

You must be logged in to vote

I worked out the solution myself. The function mikeio.Dataarray needs the time dimension. See below solution.

#%%Create a time series 
        nt =73
        time = pd.Series(pd.date_range(start_time, periods=nt, freq=dt))

        #%% Make it into a 3d array, copying the data into all the dimensions
        #To add the time reliance, it needs to be 3d  with the dim(time, y, x)
        o_shape = array.shape
        n_shape = (nt,o_shape[0],o_shape[1])
        n_3d = np.zeros(n_shape)
        n_3d[:, :, :] = array[np.newaxis, :, :]
        
        array = n_3d
        #%% Create geometry and dfs2 file
        geometry = mikeio.Grid2D(nx=ncols, ny=nrows, dx=cellsize, dy=cellsize,
         …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RenewAndPlay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant