comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » NCDF_OPEN: Unable to open the file "(null)". (NC_ERROR=-31)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
NCDF_OPEN: Unable to open the file "(null)". (NC_ERROR=-31) [message #87173] Tue, 14 January 2014 01:07 Go to next message
Therese is currently offline  Therese
Messages: 5
Registered: May 2013
Junior Member
Hey all,

I'm trying to open netCDF-files I created by myself. In idl I have a list which contains the filenames but when I try to open the netCDF with one of those list elements it does not work:

NCDF_OPEN: Unable to open the file "(null)". (NC_ERROR=-31)

The specific file exists and is readable. The funny thing is when I just type the name of the file into the ncdf_open routine idl is able to open my file.

I'm using netcdf library version 4.2 on IDL Version 6.4 (linux x86_64 m64).


+++ short example start +++

filelist=findfile("MODIS*.nc") ; n_elements(filelist) > 0

id=ncdf_open(filelist[ii]) ; error occurs
ncdf_varget,id,0,lat
ncdf_close,id

id=ncdf_open('MODIS_GRID_h05v13.nc') ; works
ncdf_varget,id,0,lat
ncdf_close,id

+++ short example end +++


I often need to open and close those files so unfortunately typing by hand is no option...

Probably, it's a very silly problem with a simple solution but I can't get it. Please help!

Best,
Therese
Re: NCDF_OPEN: Unable to open the file "(null)". (NC_ERROR=-31) [message #87174 is a reply to message #87173] Tue, 14 January 2014 01:25 Go to previous message
Therese is currently offline  Therese
Messages: 5
Registered: May 2013
Junior Member
Okay,
it was really silly. Problem is solved: filelist[ii] was no expression but an array[1]. Just saved the filename in tmp=filelist[ii] and then opened the file by id=ncdf_open(tmp[0]) ...
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Active main program terminated by call to DELVAR when using Delvar
Next Topic: IDL Beginner, plot values from specified x,y of an hdf variable

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:14:10 PDT 2025

Total time taken to generate the page: 0.00537 seconds