Replies: 5 comments 2 replies
-
What do you mean? What do you replace the OrderedDict with? |
Beta Was this translation helpful? Give feedback.
-
a regular dictionary |
Beta Was this translation helpful? Give feedback.
-
an example variables = {
'ID': {'dtype': np.int32, # Unique numerical identifier
'seed': False,
'default': -1}, # ID to be assigned by application
'status': {'dtype': np.int32, # Status categories
'seed': False,
'default': 0},
'moving': {'dtype': np.int32, # Set to 0 for elements which are frosen
'seed': False,
'default': 1},
'age_seconds': {'dtype': np.float32,
'units': 's',
'seed': False,
'default': 0},
'origin_marker': {'dtype': np.int16,
'unit': '',
'description': '''An integer kept constant during the simulation.
Different values may be used for different seedings,
to separate elements during analysis.
With GUI, only a single seeding is possible.''',
'default': 0},
'lon': {'dtype': np.float32,
'units': 'degrees_east',
'standard_name': 'longitude',
'long_name': 'longitude',
'seed': False,
'axis': 'X'},
'lat': {'dtype': np.float32,
'units': 'degrees_north',
'standard_name': 'latitude',
'long_name': 'latitude',
'seed': False,
'axis': 'Y'},
'z': {'dtype': np.float32,
'units': 'm',
'standard_name': 'z',
'long_name': 'vertical position',
'axis': 'Z',
'positive': 'up',
'default': 0}
} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Ok, some places can probably be replaced with regular dicts. Like the one you suggest. But many other places require the order, like priority_readers. |
Beta Was this translation helpful? Give feedback.
-
OrderectDict specifics used by Opendrift has been part of python since 3.6 and doesn't need to be part of it anymore. It also slower than the native dictionaries present in python 3 apparently. Collection is also not very supported for that side of things if I understood well.
I have found these occurrences in the code
https://github.com/search?q=repo%3AOpenDrift%2Fopendrift%20OrderedDict&type=code
In 10 minutes I have removed the imports and the use of it.
OpenDrift works perfectly fine without it and it is an opportunity to remove a library import and a layer of clutter.
Beta Was this translation helpful? Give feedback.
All reactions