forked from MPAS-Dev/MPAS-Model
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
@pwolfram, I think the dimensions of verticalTreatment should be changed ti just nParticles from (nParticles, Time). Would I be correct in thinking a particle should never transform its mode? I.e., it is only dependent on particle integer.
This becomes an issue when post-processing. In the following example (with trimmed down output):
ds = xr.open_dataset('mpaso.hist.am.lagrPartTrack.0034-01-01_00.00.00.nc')
ds.attrs = ''
print(ds)
<xarray.Dataset>
Dimensions: (Time: 15, nParticles: 1037200)
Dimensions without coordinates: Time, nParticles
Data variables:
indexToParticleID (nParticles) int32 ...
particleDIC (Time, nParticles) float64 ...
verticalTreatment (Time, nParticles) int32 ...
xParticle (Time, nParticles) float64 ...
xtime (Time) |S64 ...
yParticle (Time, nParticles) float64 ...
zLevelParticle (Time, nParticles) float64 ...
zParticle (Time, nParticles) float64 ...If I want to select for just surface floats to slim down the size:
ds = ds.where(ds.verticalTreatment==1, drop=True)
print(ds)
<xarray.Dataset>
Dimensions: (Time: 15, nParticles: 64825)
Dimensions without coordinates: Time, nParticles
Data variables:
indexToParticleID (nParticles, Time) float64 9.724e+05 ... 1.037e+06
particleDIC (Time, nParticles) float64 1.923e+03 ... 2.189e+03
verticalTreatment (Time, nParticles) float64 1.0 1.0 1.0 ... 1.0 1.0 1.0
xParticle (Time, nParticles) float64 1.78e+06 ... -3.444e+06
xtime (Time, nParticles) object b'0034-01-02_00:00:00 ' ... b'0034-01-30_00:00:00 '
yParticle (Time, nParticles) float64 -4.414e+06 ... 8.133e+05
zLevelParticle (Time, nParticles) float64 -2.637 -1.952 ... -2.345
zParticle (Time, nParticles) float64 4.235e+06 ... 5.298e+06note that indexToParticleID and xtime get converted to different data types and attempt to broadcast to the (Time, nParticles) format of verticalTreatment. If I select just one time slice of verticalTreatment, the where function proceeds as expected:
ds = ds.where(ds.verticalTreatment.isel(Time=0)==1, drop=True)
print(ds)
<xarray.Dataset>
Dimensions: (Time: 15, nParticles: 64825)
Dimensions without coordinates: Time, nParticles
Data variables:
indexToParticleID (nParticles) float64 9.724e+05 9.724e+05 ... 1.037e+06
particleDIC (Time, nParticles) float64 1.923e+03 ... 2.189e+03
verticalTreatment (Time, nParticles) float64 1.0 1.0 1.0 ... 1.0 1.0 1.0
xParticle (Time, nParticles) float64 1.78e+06 ... -3.444e+06
xtime (Time, nParticles) object b'0034-01-02_00:00:00 ' ... b'0034-01-30_00:00:00 '
yParticle (Time, nParticles) float64 -4.414e+06 ... 8.133e+05
zLevelParticle (Time, nParticles) float64 -2.637 -1.952 ... -2.345
zParticle (Time, nParticles) float64 4.235e+06 ... 5.298e+06Metadata
Metadata
Assignees
Labels
No labels