help on opening nc file

99 views
Skip to first unread message

Sze Mian Kueh

unread,
Mar 14, 2013, 2:08:17 AM3/14/13
to ncto...@googlegroups.com
Dear sir/mdm,

I have downloaded a netcdf file from CIMP wesite named as 'pcmdi.ipcc4.mpi_echam5.sresa2.run1.monthly.pr_A1.nc'. i open it using ncdataset function but i get this error message:

??? Error using ==> ncdataset>ncdataset.ncdataset at
91
Failed to open

Caused by:
    Java exception occurred:
    java.io.FileNotFoundException:
    (The system cannot find the file specified)

Your help is very much appreciated.


Best Regards,
kenny

Brian Schlining

unread,
Mar 14, 2013, 12:57:43 PM3/14/13
to ncto...@googlegroups.com, ksmi...@gmail.com
Hi Kenny,

I have downloaded a netcdf file from CIMP wesite named as 'pcmdi.ipcc4.mpi_echam5.sresa2.run1.monthly.pr_A1.nc'. i open it using ncdataset function but i get this error message:

??? Error using ==> ncdataset>ncdataset.ncdataset at
91
Failed to open

Caused by:
    Java exception occurred:
    java.io.FileNotFoundException:
    (The system cannot find the file specified)

All that says is that you haven't given the correct name or path to ncdataset, so it can't find the file.

1) In Matlab are you in the same directory as the file? If not, you will need to use a full path to the file. For example: '/Users/kenny/Downloads/pcmdi.ipcc4.mpi_echam5.sresa2.run1.monthly.pr_A1.nc'. To check if the file is in the current directory in Matlab, just use the 'ls' command.

2) What is the default encoding for text on your system? The underscores in the file may be in a different encoding; the underscore you type on the keyboard may have a different underlying value than the on in the filename. You can try to rename the file to something else without those underscores and see if that helps.

Good luck

Brian Schlining

Brian Schlining

unread,
Mar 15, 2013, 11:33:20 AM3/15/13
to Sze Mian Kueh, ncto...@googlegroups.com
Hi Kenny,

Thank you for your reply, I used the full path name and get it. Since I have gone through the documentation, and I need another help:

the data is in [1200 96 192] in the format of [time lat lon];

now I want to extract the data from 1 degree Lat and 110 degree Lon.

How may i do it?

From the documentation there is the firstIdx and lastIdx, as follows:

firstID= [1200 1 110];
lastID=[1200 2 111];
t=ds.data('pr',firstID,lastID);

but the result is not as i wanted. the expected result should be have 1200 of time slices for the location in between firstID and lastID. Instead I was given:

t(:,:,1) =

  1.0e-004 *

    0.0107    0.1034

t(:,:,2) =

  1.0e-004 *

    0.0106    0.1168

May I know what is the appropriate way to extract 1200 slices of data from 1 degree Lat and 110 degree Lon??

Try:  
firstID = [1 1 110];
lastID = [1200 1 110];
t = ds.data('pr', firstID, lastID);

Cheers

-- 
Brian Schlining 

Reply all
Reply to author
Forward
0 new messages