Skip to content

Issue with writing SSM file #2071

Closed Answered by mwtoews
luthermiles asked this question in Q&A
Discussion options

You must be logged in to vote

The dict comprehension line with {time: ssm_data for time in range(nper)} is suspect, because it references the same object 80 times without a copy. Also, depending on where you read the code, ssm_data is either a list with 2433 items, or it is a dict with 80 items.

Here is what ssm_data looks like after the dict comprehension line, which shows that all the items in the dict are the same object:

type(ssm_data)  # dict
len(ssm_data)  # 80
len(ssm_data[0])  # 2433 == nlay * nrow
ssm_data[0] is ssm_data[1]  # True; first and second are the same
all(ssm_data[0] is ssm_data[key] for key in ssm_data.keys())  # True; all items are the same

and since they are all the same, then modifying one will…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by wpbonelli
Comment options

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