question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

open netCDF gives 'time' dim with 1969 change in timezone

See original GitHub issue

I’m on xarray version 0.7.2 netCDF4-python version 1.2.2 Python version via Conda: 3.5.1 |Continuum Analytics, Inc.| (default, Dec 7 2015, 11:16:01) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]

The time dim on Datasets read in from netCDF files seems to change timezones in 1969. This is especially a pain for annual data because the bug causes annual indexes to shift by one year. I’ve seen this problem in reanalysis for NCEP/NCAR, Twentieth Century Reanalysis, and some reconstructed SST fields.

For example, if a read in a netCDF file. Take NCEP/NCAR Reanalysis 1 monthly mean geopotential height as an example (ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis.derived/pressure/hgt.mon.mean.nc ; a 278 MB file).

import xarray as xr

ds = xr.open_dataset('~/Downloads/hgt.mon.mean.nc')
print(ds.time)

The interesting part of this printed time dim is always around 1969:

   ...
   '1969-09-01T00:00:00.000000000Z', '1969-10-01T00:00:00.000000000Z',
   '1969-11-01T00:00:00.000000000Z', '1969-12-01T00:00:00.000000000Z',
   '1969-12-31T17:00:00.000000000-0700',
   '1970-01-31T17:00:00.000000000-0700',
   '1970-02-28T17:00:00.000000000-0700',
    ...

You can see we go from Z to-0700. It also gives me an extra measure for Dec 1969 :-\

I don’t think this is a hidden calendar or datetime-like feature that I’m unaware of…? Seems like a bug with you guys or upstream.

Thanks for your help!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fmaussioncommented, Jun 4, 2016

The best channel out there is definitely conda-forge: https://conda-forge.github.io/

Check it out!

0reactions
shoyercommented, Jun 4, 2016

+1 for conda-forge. We should add a note about it to the install page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change time zone for netcdf file - GIS Stack Exchange
For example, I have a netcdf file from WRF model, and its time zone is in UTM 00. I want to change the...
Read more >
NetCDF: Release Notes - Unidata Software Documentation
Release notes file for the netcdf-c package. This file contains a high-level description of this package's evolution. Releases are in reverse chronological ...
Read more >
open netcdf file with different years - Esri Community
Once added to your map, double click on the layer and click on the NetCDF tab. Under this tab you can click on...
Read more >
Setting the time properties on data—ArcMap | Documentation
For netCDF raster layers, you can only specify the time dimension that allows you to visualize data over time.
Read more >
dimension called "time" exists, but variable "time" uses a ...
Here's the procedure that worked for me using only NCO commands (no ncdump/manual edit/ncgen step):. Extract 4 time steps from OPeNDAP dataset to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found