Previous SAXO Documentation Assistant: Overview Next

ReadWrite/

write_ncdf.pro

Construct a netcdf file containing up to 30 variables of any dimension (limited to 99 for now) with any attributes specified. We use structures to pass the fields (var and their attributes, and global attr)

Routine summary

writenc_unlimdim_update, dnames_imposed, unl_imposed, fmtbase, nviv, iidp1st, nn, dst, iid, SUPERTABU=SUPERTABU, DIMSIZESU=DIMSIZESU, UNLIMTABAU=UNLIMTABAU, UNLIMAU=UNLIMAU, DIMIDASU=DIMIDASU, NDIMTOTU=NDIMTOTU, DNAMOSSU=DNAMOSSU, DNAMAU=DNAMAU, IMPOSE_DNM_UNLU=IMPOSE_DNM_UNLU
result = writenc_str2strlc(structa)
SUBROUTINE (2)/(3) : on remplace la 4ieme structure de structa par une liste chainee afin d uniformaiser les format de strd (cf prog write_ncdf) pour les passer facilement en argument au sous-prog writenc_unlimdim_update, sous forme de tablo de structures de meme type !!!! (utilise si writenc_unlimdim_update est utilise i.
result = writenc_strlc2str(strwlist)
SUBROUTINE (3)/(3) : convertit une structure contenant une liste chainee en structure classique utilisee par le main prog (utile pour passer ces structures en argument au sous-prog writenc_unlimdim_update, i.
write_ncdf, var01[, var02], var03, var04, var05, var06, var07, var08, var09, var10, var11, var12, var13, var14, var15, var16, var17, var18, var19, var20, var21, var22, var23, var24, var25, var26, var27, var28, var29, var30[, FILENAME=FILENAME][, GLOBATTR=GLOBATTR][, VARNAME=VARNAME], NOT_SDISV=NOT_SDISV, NOT_OUASSALU=NOT_OUASSALU, OKNAN=OKNAN
pro write_ncdf, var01,var02,var03,var04,var05,var06,var07,var08,var09,var10 $ ,var11,var12,var13,var14,var15,var16,var17,var18,var19,var20 $ ,var21,var22,var23,var24,var25,var26,var27,var28,var29,var30 $ ,FILENAME=filename $ ,GLOBATTR=globattr $ ,VARNAME=namevquick ---------------------------------------------------------------------------------------------

 

writenc_unlimdim_update

writenc_unlimdim_update, dnames_imposed, unl_imposed, fmtbase, nviv, iidp1st, nn, dst, iid, SUPERTABU=SUPERTABU, DIMSIZESU=DIMSIZESU, UNLIMTABAU=UNLIMTABAU, UNLIMAU=UNLIMAU, DIMIDASU=DIMIDASU, NDIMTOTU=NDIMTOTU, DNAMOSSU=DNAMOSSU, DNAMAU=DNAMAU, IMPOSE_DNM_UNLU=IMPOSE_DNM_UNLU

Parameters

dnames_imposed       

unl_imposed       

fmtbase       

nviv       

iidp1st       

nn       

dst       

iid       

Keywords

SUPERTABU       

DIMSIZESU       

UNLIMTABAU       

UNLIMAU       

DIMIDASU       

NDIMTOTU       

DNAMOSSU       

DNAMAU       

IMPOSE_DNM_UNLU       

 


writenc_str2strlc

result = writenc_str2strlc(structa)

SUBROUTINE (2)/(3) : on remplace la 4ieme structure de structa par une liste chainee afin d uniformaiser les format de strd (cf prog write_ncdf) pour les passer facilement en argument au sous-prog writenc_unlimdim_update, sous forme de tablo de structures de meme type !!!! (utilise si writenc_unlimdim_update est utilise i.e. dans le cas ou la cle NOT_OUASSALU est pas active, i.e. cas par defaut)

Parameters

structa       

 


writenc_strlc2str

result = writenc_strlc2str(strwlist)

SUBROUTINE (3)/(3) : convertit une structure contenant une liste chainee en structure classique utilisee par le main prog (utile pour passer ces structures en argument au sous-prog writenc_unlimdim_update, i.e. dans le cas ou la cle NOT_OUASSALU n est pas activee, i.e. cas par defaut)

Parameters

strwlist       

 


write_ncdf

write_ncdf, var01[, var02], var03, var04, var05, var06, var07, var08, var09, var10, var11, var12, var13, var14, var15, var16, var17, var18, var19, var20, var21, var22, var23, var24, var25, var26, var27, var28, var29, var30[, FILENAME=FILENAME][, GLOBATTR=GLOBATTR][, VARNAME=VARNAME], NOT_SDISV=NOT_SDISV, NOT_OUASSALU=NOT_OUASSALU, OKNAN=OKNAN

pro write_ncdf, var01,var02,var03,var04,var05,var06,var07,var08,var09,var10 $ ,var11,var12,var13,var14,var15,var16,var17,var18,var19,var20 $ ,var21,var22,var23,var24,var25,var26,var27,var28,var29,var30 $ ,FILENAME=filename $ ,GLOBATTR=globattr $ ,VARNAME=namevquick ---------------------------------------------------------------------------------------------

Return value

a netcdf file containing the variable in the format specified through keywords and variables

Parameters

var01        in required

} Namely, the if vv1 is a structure it MUST follow the following points: - attributes fields for the variable (at0,at1...) MUST be the last fields of the vv1 structure and name of those fields (at0,at1...) are not important. - attributes MUST themselves be given in the form of a 2 field structure, containing the name of the attribute (a string), and its value (can be any type as the ones of variable) - order of the first fields is not important but they MUST have the names: 'var' : for the variable (scalar or array, of type:byte,int,long,float,double or string) 'name' : for its name (a string), default value is var01,var02 etc... 'unlim' : = 1 to specify that the last dim of the var must be UNLIMITED, =0 or not specified otherwise 'dname' : to give the names of the dimensions of the variable, in the same order as the var dimensions. it is an array of string of dim = nbre de dim de la var. default is d01,d02 etc... - the field 'var' MUST be there (a variable) but every others are optional - if a missing value exists for the variable and one wants to specify it, it MUST be specified somewhere in one of the attributes and the name of this attribute MUST be 'missing_value' (to be taken into account in the computing of the min-max of the variable), missing_value being not case sensitive (MISSING_VALUE is also ok)

var02        in optional

All the variables/attributes to be written in the netcdf file, in the same way as the var01 (cf info above)

var03       

var04       

var05       

var06       

var07       

var08       

var09       

var10       

var11       

var12       

var13       

var14       

var15       

var16       

var17       

var18       

var19       

var20       

var21       

var22       

var23       

var24       

var25       

var26       

var27       

var28       

var29       

var30       

Keywords

FILENAME        in optional

- a string giving the filename (including the path of the file) - if not specified, it is set to iodir+'writenclem.nc'

GLOBATTR        in optional

} - if not specified in globattr, default case set production='date of day' as a global attribute

VARNAME        in optional

- an array of char, same number of elements as the number of given var - if specified, it gives the names of the variables as an array for the default name values (if one of the var is structure and also has the name field given, then the latter will be the one chosen and not namevquick)

NOT_SDISV       

NOT_OUASSALU       

OKNAN       

Examples


 1)
   IDL> write_ncdf, vvsst, btoa

 2)
   IDL> write_ncdf, a1, {var:a2,name:'rain'}, ['up','down','fix'], a4, a5, {var:a6,unlim:1,name:'sst',dname:['x','y','z','time']}

 3)
   IDL> write_ncdf,v031tr,msf031dn,msf031up,v031,vmaskloc,btoa,runame,titplo1,vargrid,nytt                                    $
           ,varname = ['v031tr','msf031dn','msf031up','v031','vmaskloc','btoa','runame','titplo1','vargrid','nytt'] $
           ,filename = iodir+'IDL_DATA/'+'waza3.nc'

 4)
   IDL> fileoutnc = iodir+'OBS/TRMM/'+'trmm_1d_'+iyystr+'0101_'+iyystr+'1231_reg0.25.nc'
   IDL> vv1 = {var:xaxis,name:'nav_lon',dname:'x',at1:{a:'units',b:'degrees_east'},at2:{a:'title',b:'longitude'}}
   IDL> vv2 = {var:yaxis,name:'nav_lat',dname:'y',at1:{a:'units',b:'degrees_north'},at2:{a:'title',b:'latitude'}}
   IDL> vv3 = {var:ttt,name:'time',dname:'time_counter',unlim:1,at1:{a:'units',b:timeunit},at2:{a:'title',b:'julian days'}  $
   IDL> vv4 = {var:rain_i2, name:'rain' $
        ,at1:{a:'units',b:'mm/day'} $
        ,at2:{a:'title',b:'trmm daily accumulated rainfall derived from the 3-hourly product (mm)'}  $
        ,at3:{a:'scale_factor',b:scala_factor} $
        ,at4:{a:'add_offset',b:adda_offset}    $
        ,at5:{a:'missing_value',b:missaval_i2} $
       }
   IDL> glbatt={  gb1:{a:'File_Name', b:'trmm_1d_'+iyystr+'0101_'+iyystr+'1231_reg0.25.nc'} $
          ,gb2:{a:'Model_Name', b:'TRMM 3B42_V6 derived product'} $
          ,gb3:{a:'Source_File',b:'ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/Derived_Products/3B42_V6/Daily/'+iyystr+'/*.bin'} $
    

Version history

History

CBM 2007-09-10

Known issues

Todo items

clem

Other attributes

Uses routines

cm_general for iodir variable

 


  Produced by IDLdoc 2.0.