[Thread Prev][Thread Next][Index]

Re: [ferret_users] append by column when writing from netCDF to ArscII possible?



hi -
You are right, Ferret doesn't have a way to append to the end of the line.  You could read all of the variables back in using the FILE/FORM=DELIMITED syntax and then write all 5 of your variables together.  Another option is to make a separate file and then use whatever tools there are with Excel to merge the two files.

-Ansley

On 6/1/2011 7:38 AM, Chao YUE wrote:
Thank you.

I should have made my questions more specific. suppose I want to pick up the values of some variables from 3 nc files.

say data1.nc, data2.nc, data3.nc all have variables var1,var2 (or even more). but these nc files have only one time step. ie. variables have only one value.
we can use

yes? use data1.nc
yes? use data2.nc
yes? use data3.nc
yes? list/file=data.txt/clobber/norow/nohead/for="" " ", "data1", "data2", "data3"
yes? list/file=data.txt/clobber/norow/nohead/for="" "var1",var1[d=1],var1[d=2],var1[d=3]
yes? list/file=data.txt/clobber/norow/nohead/for="" "var2",var2[d=1],var2[d=2],var2[d=3]
yes? list/file=data.txt/clobber/norow/nohead/for="" "var3",var3[d=1],var3[d=2],var3[d=3]

data.txt is like:

" ", "data1", "data2", "data3"
"var1", 2, 3, 4
"var2", 7,8,9
"var3", 20,21,22

you can simple use this data by excel.

but now if I have two extra data4.nc, data5.nc having the same variables as data1/2/3.nc
In the above code, I must add var1[d=4],var1[d=5]... var2[d=4],var2[d=5] at the end of each line.
when you use

yes? list/append qualifier, it can only append data by line way? maybe this question is stupide because I know for may languages, appending by column is very difficult.

Thanks again,

Chao

2011/6/1 Yu, Hao-Cheng <danish.url@xxxxxxxxx>
Dear Chao

Assume data is 2-D variable, like var(1:10,1:10)
Try with
list/form=(10f8.2)/nohead/file=ascii_data.dat var
ferret will produce ascii_data.dat with 10 columns data.
Open with excel by importing function with assigning separate character with Blank,
Excel will treat data as 10 columns table. 

Regards, dan


2011/6/1 Chao YUE <chaoyuejoy@xxxxxxxxx>
Dear ferreters,

I have a question, is it possible to append by columns (rather than by line) when pick up some variables from NetCDF file to csv?

much thanks,

Chao

--
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 77 30; Fax:01.69.08.77.16
************************************************************************************





--
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 77 30; Fax:01.69.08.77.16
************************************************************************************


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement