Skip to content

time issue in netcdf #85

@FuncUny

Description

@FuncUny

Hi! I am really excited to use the package. My data is a large set of high-resolusion model data (a sub-region dataset of llc4320) stored in separate netCDF files for each day (I take 10 days for test, 20120210 to 20120219), with each file containing variables like u, v, w, salt, temp, etc in 24 timesteps. I run the package successfully, but I find that the output file (here is LF_2012021X.nc, see codes below) have an error in the 'time' coordinate. Besides, a warningabout it (says the output time data won't make sense, see the last line in my main WARNING information) was also showed when running this package. Here is my codes and warning I've got:

---- My codes: ----

fdir= f'/data/llc4320_2012021X/'
fnm = f'LLC4320_pre-SWOT_ACC_SMST_2012021*.nc'
grid_dir = '/data/llc4320_2012021X/LLC4320_pre-SWOT_ACC_SMST_20120210.nc'

filenames = {
    "U": {"lat": grid_dir, "lon": grid_dir, "depth": grid_dir, "data": fdir+fnm},
    "V": {"lat": grid_dir, "lon": grid_dir, "depth": grid_dir, "data": fdir+fnm},
    "W": {"lat": grid_dir, "lon": grid_dir, "depth": grid_dir, "data": fdir+fnm},
}
variables = {"U":"U", "V":"V", "W":"W"} #,"P": "PHIHYD", "RHO": "RHOAnoma"}
dimensions = {
  "U":   {"time": "time", "depth": "Z", "lat": "YC", "lon": "XC"},
  "V":   {"time": "time", "depth": "Z", "lat": "YC", "lon": "XC"},
  "W":   {"time": "time", "depth": "Z", "lat": "YC", "lon": "XC"},
}
indices = {"depth": [36]}

f = filtering.LagrangeFilter(
    "LF_2012021X", filenames, variables, dimensions, sample_variables=["W"],
    mesh="spherical", c_grid=True, indices=indices, window_size=timedelta(days=2).total_seconds(),
)
f()

---- My main WARNING information: ----

WARNING: dt or runtime are zero, or endtime is equal to Particle.time. The kernels will be executed once, without incrementing time
WARNING:parcels.tools.loggers:dt or runtime are zero, or endtime is equal to Particle.time. The kernels will be executed once, without incrementing time
INFO: Temporary output files are stored in /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5.
INFO:parcels.tools.loggers:Temporary output files are stored in /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5.
INFO: You can use "parcels_convert_npydir_to_netcdf /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5" to convert these to a NetCDF file during the run.
INFO:parcels.tools.loggers:You can use "parcels_convert_npydir_to_netcdf /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5" to convert these to a NetCDF file during the run.
100% (172800.0 of 172800.0) |############| Elapsed Time: 0:02:14 Time:  0:02:14
INFO: Temporary output files are stored in /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5.
INFO:parcels.tools.loggers:Temporary output files are stored in /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5.
INFO: You can use "parcels_convert_npydir_to_netcdf /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5" to convert these to a NetCDF file during the run.
INFO:parcels.tools.loggers:You can use "parcels_convert_npydir_to_netcdf /data/home/zhangrd/AIswot/tmpz1k8zdo8.h5" to convert these to a NetCDF file during the run.
100% (172800.0 of 172800.0) |############| Elapsed Time: 0:02:16 Time:  0:02:16
WARNING:root:data file for field 'U' has only one of 'units' and 'calendar' attributes, the output time data won't make sense

---- Here is more information that I can give ----

  1. The 'time' in my dataset is an xarray.DataArray:
array(['2012-02-10T00:00:00.000000000', '2012-02-10T01:00:00.000000000',
       '2012-02-10T02:00:00.000000000', ..., '2012-02-19T21:00:00.000000000',
       '2012-02-19T22:00:00.000000000', '2012-02-19T23:00:00.000000000'],
      dtype='datetime64[ns]'), 

with attributes:

Longname :center time of snapshots
axis :T
coverage_content_type :coordinate
standard_name :time
  1. The 'time' in output dataset (LF_2012021X.nc) is like:
 array([1.329005e+18, 1.329008e+18, 1.329012e+18, …,1.329516e+18, 1.329520e+18], dtype=float32),

with attributes:

Longname :center time of snapshots
axis :T
coverage_content_type :coordinate
standard_name :time
units :hours since 2011-01-01 00:00:00

How to solve this problem? Also, I’d like to know if this issue will affect the the filtering results? (Maybe not but im not sure, because I set ±2 days window and I got 144 hours (central 6 days in the total 10 days) output in LF_2012021X.nc)
I appreciate your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions