Re: addfile() for create new nc file

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 06 2011 - 10:23:33 MDT

Hi,

NetCDF doesn't allow you to have strings for coordinate arrays. You
must convert these to 2D character arrays.

Please see the "Coordinate Systems" section of this NetCDF document:

http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html

I don't know how you created "season" in your code below, but you can
try converting it to a character array, and use this as your
coordinate variable:

    cseason = tocharacter(season)
   multidata&season = cseason

--Mary

On Jun 6, 2011, at 1:11 AM, gibies george wrote:

> Dear NCL users,
>
> Somebody please suggest a way to eliminate the following warning
> messages.
>
> I was trying to write my dataset to an nc file.
>
> Thanking you in davance.
>
> _______________________________________
> ________________Script__________________
> _______________________________________
> -------------------------
> -----------------------
> ----------------------------
> ---------------------
> --------------------------
>
> multidata@dataset = mdl@analdset + "_" +
> predef@anal_start_year + "_to_" + predef@anal_end_year
> multidata@datavar = datavar
> multidata&ens = ens
> multidata&mdl = mdl
> print("---------------Multimodel Ensemble-------------------")
> print("_____________________________________________________")
> printVarSummary(multidata)
> print("_____________________________________________________")
>
> syout= systemfunc("rm " + mdl@analdset+"_multimodel_data.nc")
> outfile = addfile(mdl@analdset+"_multimodel_data.nc","c")
> outfile->multi_model_data = multidata
>
> return(multidata)
> end ;;; End of function definition get_multimodel_data() ;;;
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> _______________________________________
>
> _________________________________
> ___________ Output _______________
> _________________________________
>
>
> (0) ---------------Multimodel Ensemble-------------------
> (0) _____________________________________________________
>
>
> Variable: multidata
> Type: float
> Total Size: 272160000 bytes
> 68040000 values
> Number of Dimensions: 7
> Dimensions and sizes: [time | 25] x [lat | 280] x [lon | 360] x
> [season | 1] x [component | 3] x [ens | 1] x [mdl | 9]
> Coordinates:
> time: [1981..2005]
> lat: [-35..35]
> lon: [30..120]
> season: [ond..ond]
> component: [rain..tsfc]
> ens: [..]
> mdl: [cfsv2_jun_init..DePreSys_UKMO_aug_init]
> Number Of Attributes: 18
> unit : ( mm/day, hPa, degC )
> units : ( mm/day, hPa, degC )
> region : indotropic
> ssnend : 12
> ssnbegin : 10
> dataset : ond_skill_1981_to_2005
> datavar : _rain_mslp_tsfc
> anal_start_year : 1981
> anal_end_year : 2005
> latsouth : -35
> latnorth : 35
> lonwest : 30
> loneast : 120
> mpCenterLonF : 75
> novctr : 0
> nosclr : 3
> long_name : _rain_mslp_tsfc
> _FillValue : -9.96921e+36
> (0) _____________________________________________________
> fatal:Attempting to write variable (season) of type (string) which
> is not representable in the format of file
> (ond_skill_multimodel_data.nc)
> fatal:Trying using a type conversion function
> warning:FileWriteVarVar: Could not write coordinate variable
> (season) to file (ond_skill_multimodel_data), continuing anyway
> fatal:Attempting to write variable (component) of type (string)
> which is not representable in the format of file
> (ond_skill_multimodel_data.nc)
> fatal:Trying using a type conversion function
> warning:FileWriteVarVar: Could not write coordinate variable
> (component) to file (ond_skill_multimodel_data), continuing anyway
> fatal:Attempting to write variable (ens) of type (string) which is
> not representable in the format of file (ond_skill_multimodel_data.nc)
> fatal:Trying using a type conversion function
> warning:FileWriteVarVar: Could not write coordinate variable (ens)
> to file (ond_skill_multimodel_data), continuing anyway
> fatal:Attempting to write variable (mdl) of type (string) which is
> not representable in the format of file (ond_skill_multimodel_data.nc)
> fatal:Trying using a type conversion function
> warning:FileWriteVarVar: Could not write coordinate variable (mdl)
> to file (ond_skill_multimodel_data), continuing anyway
> warning:Execute: Error occurred at or near line 3188 in file /home/
> gibies/ncl/mylib/lib_gibies_read_data_module.ncl
>
>
>
> --
> Gibies George, CSIR-RF,
> Monsoon Seasonal Prediction Group,
> Climate and Global Modelling Division,
> Indian Institute of Tropical Meteorology,
> Dr. Homi Bhabha Road,
> NCL (P. O.), Pashan,
> Pune 411008, India.
>
> http://sites.google.com/site/gibiesge/
>
> Please Think about the environment. Save paper; Save Trees; and
> don't print this e-mail unless it is necessary.
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 6 10:23:55 2011

This archive was generated by hypermail 2.1.8 : Thu Jun 09 2011 - 14:56:48 MDT