Re: problem opening netcdf file

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue, 25 Sep 2007 09:45:55 -0600

Hi Sara,

I downloaded your .nc file, and successfully opened it in ncl:

/home>ncl
  Copyright (C) 1995-2007 - All Rights Reserved
  University Corporation for Atmospheric Research
  NCAR Command Language Version 4.3.1
  The use of this software is governed by a License Agreement.
  See http://www.ncl.ucar.edu/ for more details.
ncl 0> a = addfile("MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc","r")
ncl 1> printVarSummary(a)

Variable: a
(0)
filename: MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr
path: MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc
    file global attributes:
       institution : MPI-M
       Conventions : CF-1.0
       conventionsURL :
http://www.cgd.ucar.edu/cms/eaton/cf-metadata/index.html
       source : REMO
       project_id : ENSEMBLES
       experiment_id : RT3 50
       realization : 1
       creation_date : 2006-12-22 11:49:36
    dimensions:
       ncl_scalar = 1
       bnds = 2
       rlon = 85
       rlat = 95
       time = 120 // unlimited
    variables:
       character rotated_pole ( ncl_scalar )
          grid_mapping_name : rotated_latitude_longitude
          grid_north_pole_latitude : -162
          grid_north_pole_longitude : 39.25

       float rlon ( rlon )
          axis : X
          standard_name : grid_longitude
          long_name : longitude in rotated pole grid
          units : degrees

       float lon ( rlat, rlon )
          standard_name : longitude
          long_name : longitude
          units : degrees_east

       float rlat ( rlat )
          axis : Y
          standard_name : grid_latitude
          long_name : latitude in rotated grid
          units : degrees

       float lat ( rlat, rlon )
          standard_name : latitude
          long_name : latitude
          units : degrees_north

       double time ( time )
          units : months since 1950-01-01 00:00:00
          standard_name : time
          long_name : time
          calendar : standard
          bounds : time_bnds

       double time_bnds ( time, bnds )
          long_name : time bounds

       float pr ( time, rlat, rlon )
          standard_name : precipitation_flux
          long_name : Precipitation
          units : kg m-2 s-1
          cell_methods : time: mean
          coordinates : lon lat
          grid_mapping : rotated_pole
          _FillValue : 1e+30

ncl 2> pr = a->pr
ncl 3>

Within your ncl script, make sure that you are pointing to the correct
directory location for the file. (The error message you are getting can
be generated when you refer to a file that isn't present.) If you are
pointing to the correct location of the file, and you still cannot get
the file to read in, let us know, and tell us what version of NCL you
are using... Adam

Rauscher Sara A wrote:
> Hi,
>
> I am having trouble opening a netCDF file with NCL. I get the following
> message:
>
> lncopen: filename "MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc": Not a
> netCDF file
> fatal:The specified netCDF file
> (MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc) does not exist or can't
> be opened
>
> The .nc file is in the correct directory, and I can look at the data in
> the file using ncview -- the data look reasonable. A ncdump -h of the
> .nc file gives the following:
>
> netcdf MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr {
> dimensions:
> bnds = 2 ;
> rlon = 85 ;
> rlat = 95 ;
> time = UNLIMITED ; // (120 currently)
> variables:
> char rotated_pole ;
> rotated_pole:grid_mapping_name =
> "rotated_latitude_longitude" ;
> rotated_pole:grid_north_pole_latitude = -162.f ;
> rotated_pole:grid_north_pole_longitude = 39.25f ;
> float rlon(rlon) ;
> rlon:axis = "X" ;
> rlon:standard_name = "grid_longitude" ;
> rlon:long_name = "longitude in rotated pole grid" ;
> rlon:units = "degrees" ;
> float lon(rlat, rlon) ;
> lon:standard_name = "longitude" ;
> lon:long_name = "longitude" ;
> lon:units = "degrees_east" ;
> float rlat(rlat) ;
> rlat:axis = "Y" ;
> rlat:standard_name = "grid_latitude" ;
> rlat:long_name = "latitude in rotated grid" ;
> rlat:units = "degrees" ;
> float lat(rlat, rlon) ;
> lat:standard_name = "latitude" ;
> lat:long_name = "latitude" ;
> lat:units = "degrees_north" ;
> double time(time) ;
> time:units = "months since 1950-01-01 00:00:00" ;
> time:standard_name = "time" ;
> time:long_name = "time" ;
> time:calendar = "standard" ;
> time:bounds = "time_bnds" ;
> double time_bnds(time, bnds) ;
> time_bnds:long_name = "time bounds" ;
> float pr(time, rlat, rlon) ;
> pr:standard_name = "precipitation_flux" ;
> pr:long_name = "Precipitation" ;
> pr:units = "kg m-2 s-1" ;
> pr:cell_methods = "time: mean" ;
> pr:coordinates = "lon lat" ;
> pr:grid_mapping = "rotated_pole" ;
> pr:_FillValue = 1.e+30f ;
>
> // global attributes:
> :institution = "MPI-M" ;
> :Conventions = "CF-1.0" ;
> :conventionsURL =
> "http://www.cgd.ucar.edu/cms/eaton/cf-metadata/index.html" ;
> :source = "REMO" ;
> :project_id = "ENSEMBLES" ;
> :experiment_id = "RT3 50" ;
> :realization = "1" ;
> :creation_date = "2006-12-22 11:49:36" ;
> }
>
> I have no idea what the problem is. My script is pasted below:
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
>
> cru = addfile("C25_orog.nc","r")
> rcm = addfile("MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc","r")
> out = addfile("MPI-M-REMO_CTL_ERA40_MM_50km_CRU_1961-1970_pr.nc","c")
> lat = cru->latitude ; create gaussian latitudes or read from file
> lon = cru->longitude ; create longitudes or read from file
>
> lat2d = rcm->lat ; size = (nlat,nlon)
> lon2d = rcm->lon ; size = (nlat,nlon)
> pr = rcm->pr(:,:,:)
>
> xgrd = rcm2rgrid(lat2d,lon2d,pr,lat,lon,0)
> xgrd!0="time"
> xgrd&time=rcm->time(:)
> xgrd!1="latitude"
> xgrd&latitude=cru->latitude
> xgrd!2="longitude"
> xgrd&longitude=cru->longitude
>
> out->time=rcm->time
> out->latitude=cru->latitude
> out->longitude=cru->longitude
> out->xgrd = xgrd
>
> Thanks for any help or ideas. The .nc file can be downloaded at
> http://www.ictp.it/~srausche/MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc
> sara
>
>

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 25 2007 - 09:45:55 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 26 2007 - 10:02:41 MDT