[ncl-talk] converting 360 day calendar to 365 day (standard) calendar

Kwesi A. Quagraine starskykwesi at gmail.com
Sun Feb 24 15:31:53 MST 2019


Hello NCLers

I am trying to convert a netcdf file with 360 day calendar to standard, 365
day calendar with the script below; I am having errors when I try. I will
be grateful for any help.

For printVarSummary;

Variable: var
Type: float
Total Size: 37013760 bytes
            9253440 values
Number of Dimensions: 4
Dimensions and sizes: [time | 12240] x [plev | 1] x [lat | 36] x [lon | 21]
Coordinates:
            time: [43590.5..55829.5]
            plev: [70000..70000]
            lat: [-44.375..-0.625]
            lon: [6.5625..44.0625]
Number Of Attributes: 9
  standard_name : geopotential_height
  long_name : Geopotential Height
  units : m
  _FillValue : 1e+20
  missing_value : 1e+20
  original_name : mo: m01s30i207/m01s30i301
  cell_methods : time: mean
  history : 2012-06-26T08:31:01Z altered by CMOR: replaced missing value
flag (-1.07374e+09) with standard missing value (1e+20).
  associated_files : baseURL: http://cmip-pcmdi.llnl.gov/CMIP5/dataLocation
gridspecFile: gridspec_atmos_fx_HadGEM2-ES_historical_r0i0p0.nc

fatal:Coordinate variables must be the same dimension as their dimension
fatal:No coordinate variable exists for dimension (lat) in variable (zg_new)
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 25 in file


For Script:
 f = addfile("zg700_day_HadGEM2-ES_rcp85_r1i1p1_19800101-20131231.nc","r")
  var          = f->zg
  time_360     = var&time
  lat          = f->lat
  lon          = f->lon
  plev       = f->plev
  printVarSummary(var)

  time_steps               =  34*365 ;1980 to 2013
  time_365                 =  fspan(1,time_steps,time_steps)
  time_365!0               = "time"
  time_365&time            =  time_365
  time_365 at standard_name   = "time"
  time_365 at units           = "days since 1980-01-01 12:00:00"
  time_365 at calendar        = "365_day"
  time_365 at long_name       = "time"
  time_365 at axis            = "T"

  zg_new               =  linint1_n(time_360,var,False,time_365,0,0)
  zg_new!0             = "time"
  zg_new&time          =  time_365
  zg_new!1             = "lat"
  zg_new&lat          =  lat
  zg_new!2             = "lon"
  zg_new&lon          =  lon

  zg_new at _FillValue    =  1.0e+20
  zg_new at missing_value =  1.0e+20
  zg_new at standard_name = "geopotential_height"
  zg_new at long_name     = "Geopotential Height"
  zg_new at units         = "m"
  zg_new at coordinates   = "lon lat plev"
  zg_new at cell_methods  = "time: maximum"
  printVarSummary(zg_new)

  ;system("rm -rf
zg700_day_HadGEM2-ES_rcp85_r1i1p1_19800101-20131231_cal.nc")
  outf =
addfile("zg700_day_HadGEM2-ES_rcp85_r1i1p1_19800101-20131231_cal.nc","c")
  outf->lat          =  lat
  outf->lon          =  lon
  outf->plev       =  plev
  outf->zg       =  zg_new

I will be grateful for any help on this.

Thanks
Kwesi
------------
Try not to become a man of success but rather a man of value- Albert
Einstein

Kwesi A. Quagraine
Department of Physics
School of Physical Sciences
College of Agriculture and Natural Sciences
University of Cape Coast
Cape Coast, Ghana

Alt. Email: kwesi at csag.uct.ac.za
Web: http://www.recycleupghana.org/
Office: +27 21 650 3164
Skype: quagraine_cwasi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190224/4f4a4881/attachment.html>


More information about the ncl-talk mailing list