You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defwrite(self, pset, time, sync=True, deleted_only=False):
126
132
"""Write :class:`parcels.particleset.ParticleSet` data to file
127
133
128
134
:param pset: ParticleSet object to write
@@ -132,14 +138,17 @@ def write(self, pset, time, sync=True):
132
138
"""
133
139
ifisinstance(time, delta):
134
140
time=time.total_seconds()
135
-
ifself.lasttime_written!=time: # only write if 'time' hasn't been written yet
141
+
ifself.lasttime_written!=timeand \
142
+
(self.write_ondeleteisFalseordeleted_onlyisTrue):
143
+
136
144
self.lasttime_written=time
137
145
ifself.typeis'array':
138
146
# Check if largest particle ID is smaller than the last ID in ParticleFile.
139
147
# Otherwise, new particles have been added and netcdf will fail
140
148
ifpset.size>0:
141
149
ifmax([p.idforpinpset]) >self.id[-1]:
142
150
logger.error("Number of particles appears to increase. Use type='indexed' for ParticleFile")
151
+
exit(-1)
143
152
144
153
# Finds the indices (inds) of the particle IDs in the ParticleFile,
145
154
# because particles can have been deleted
@@ -165,7 +174,7 @@ def write(self, pset, time, sync=True):
165
174
logger.warning("Option to_write='once' is not fully functional in indexed mode! Particle properties of such variables are not written for newly added particles.")
0 commit comments