Re: problem opening netcdf file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue, 25 Sep 2007 11:51:36 -0600

Just to clarify for NCL novices [Mike is an expert] you
do not need to load any libraries.

[1] Use "ncl_filedump" which gives the
     same output as 'ncdump -h'. Note: ncl_filedump
     also allows users to look at grib-1, grib-2,
     hdf and hdf-eos.

[2] As indicated by Adam Phillips, you could look interactively

     %> ncl
     ncl > f = addfile(....)
     ncl > print(f)

[3] You could also have a two line script containing
     just the above two lines [no load and no begin/end]

Michael Notaro wrote:
> Sara,
> This worked for me OK.
>
> 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"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> begin
> a=addfile("MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc","r")
> pr=a->pr
> end
>
> Mike
>
> On Sep 25, 2007, at 10:54 AM, Rauscher Sara A wrote:
>
>> Hi Mike -
>> Thanks, but yes, that was the first thing I tried.
>> The link is
>>
>> http://www.ictp.it/~srausche/MPI-M-REMO_CTL_ERA40_MM_50km_1961-1970_pr.nc
>>
>> sara
>>
>> Michael Notaro wrote:
>>> Did you try renaming the file without dashes and/or underscores to see
>>> if that is the problem? Just an idea.
>>> The link doesn't work.
>>>
>>> Mike
>>>
>>> On Sep 25, 2007, at 10:31 AM, 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
>>>>
>>>>
>>>> --
>>>> Dr. Sara A. Rauscher
>>>> Earth System Physics Section
>>>> The Abdus Salam International Centre for Theoretical Physics
>>>> Strada Costiera 11
>>>> 34014 Trieste ITALY
>>>> ph: +39 040 2240 225 fax: +39 040 2240 449
>>>> email: srausche_at_ictp.it
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk_at_ucar.edu
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>> --
>>
>> Dr. Sara A. Rauscher
>> Earth System Physics Section
>> The Abdus Salam International Centre for Theoretical Physics
>> Strada Costiera 11
>> 34014 Trieste ITALY
>> ph: +39 040 2240 225 fax: +39 040 2240 449
>> email: srausche_at_ictp.it
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 25 2007 - 11:51:36 MDT

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