home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 436400765

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/2547#issuecomment-436400765 https://api.github.com/repos/pydata/xarray/issues/2547 436400765 MDEyOklzc3VlQ29tbWVudDQzNjQwMDc2NQ== 21049064 2018-11-06T20:40:20Z 2018-11-06T20:41:25Z NONE

Data: netcdf_files.zip

Code below:

```python import numpy as np import pandas as pd import xarray as xr from shutil import copyfile import os

data_dir = "./" filename = "Rg_dummy.nc"

get the datetime range

times = pd.date_range("2000-01-01", "2000-12-31", name="time") var = "Rg"

copyfile(filename, "temp.nc") ds = xr.open_dataset("temp.nc") print("Temporary Data read to Python")

FORWARD FILL FROM THE ORIGINAL DATA to new timesteps

ds.reindex({"time":times}) ds.ffill("time")

ds.to_netcdf(filename, format="NETCDF3_CLASSIC")

print(filename, "Written!")

remove temporary file

os.remove(data_dir+"temp.nc") print("Temporary Data Removed")

del ds

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  377947810
Powered by Datasette · Queries took 1.233ms · About: xarray-datasette