CHyM model Version 5.00 documentation
Last update: March 31, 2022.
High level interface to NetCDF library

The following rourines are available only if NetCDF library are available in the used platform.
If NetCDF library is not available, any of this the programs ends with an error message. If the user wants to change this behaviour, it is needed to change the appropriate flag:
	all mvsetflags('Netcdf error',1.0)
	
whit this setting the error message is displayed, but the execution is not stopped.
regcmreadnc(ora,giorno,mese,anno,if,pi,la,lo,n) Description
regcmreadncll(nlon,nlat,ora,giorno,mese,anno,ifl,pi,la,lo,n) Description
readnetcdfrec(file,field,rec,mat,nlon,nlat) Description
netcdf2mv(file) Description
The following two routines allow to create a netcdf file containing a CHyM field and are available only if netcdf library are available in the used platform
chym2nchead(ncs,nci,ncr)
chym2ncfield(field,ncs,nci,ncr)
chym2nchead and chym2ncfield allow to create a netcdf file containing a CHyM field. The first is used to create (or overwrite) the file, the second one is used to add the field time slice(s).
The real array field(nlon,nlat) contains, as input, the field; ncs,nci,ncr are three vectors dimensioned character ncs(10)*32 ; integer nci(10) ; real ncr(10). The meaning of the each component is specified in the following table.
Component ncs nci ncr
1 I/O filename Number of time slices to write in the nc file NOT YET USED
2 Short name of the field as an example "rain" Coded value of first saved time slice; usually CHyM variable: mchym(4)
3 Unit as an example "mm/h" Number of the current time slice to save (1, 2, ....nci(1))
4 Long name of the field as an example "Precipation field" Coded value of current time to save, usually the same of CHyM variable: time
5 NOT YET USED NOT YET USED

The following example shows how to save the precipitation fields from CHyM output

	use chymdata , only : chymreadstaticfields,mchym,temp,time
	integer i,,nci(10) ; real ncr(10) ; character ncs(10)*32
	open(10,file='tmp/oprun03.chym',status='old',form='unformatted')
	call chymreadstaticfields(10)
	ncs(1)='temp.nc' ; ncs(2)='temp' ; ncs(3)='degree (K)' ; ncs(4)='Temperature'
	nci(1)=mchym(6) ; nci(2)=mchym(4)
	call chym2nchead(ncs,nci,ncr)
	do i=1,mchym(6)
	   call chymreaddynamicfields(10)
	   nci(3)=i ; nci(4)=time
	   call chym2ncfield(temp,ncs,nci,ncr)
	enddo
	end
        
CHyM model documentation by Marco Verdecchia This document has been updated on March 31, 2022 h: 14:36