Alexander
Without having the data to run your code, it's difficult to say where the dimensions of the arrays are changing. You should be able to see from the extensive 'printVarSummary' statements you have.
That said, an easy solution would be to assign the output file coordinates directly rather than by using the getvardims() function,
i.e. the line
filevardef(fout, "S_avg" ,typeof(S_avg) ,getvardims(S_avg))
becomes
filevardef(fout, "S_avg" ,typeof(S_avg) , (/"time","zlev","lat","lon"/) )
And the same for the I_avg array.
I personally prefer to do this, especially for longer scripts, since I find that it makes any future editing/debugging easier, and forces me to think about what dimensions go where rther than relying on something I did a couple of hundred lines ago.
Will
**********************************************************
Will Hobbs, Ph.D. William.R.Hobbs@jpl.nasa.gov
Jet Propulsion Laboratory
4800 Oak Grove Dr. office: 300-324a
M/S 300-323 phone: (818) 354-0466
Pasadena, CA 91109 fax: (818) 354-0966
**********************************************************
From: Alexander Semenov <asemenov@alaska.edu<mailto:asemenov@alaska.edu>>
Date: Tue, 13 Mar 2012 13:18:16 -0700
To: "ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>" <ncl-talk@ucar.edu<mailto:ncl-talk@ucar.edu>>
Subject: creating the nc file
Hi!
I have a problem with writing out the results of averaging in netCDF file. I was hoping you could tell me where i had an error.
For some reason. My output variables S_avg and I_avg have weird dimensions:
float S_avg(zlev, zlev, lat, lon) ;
S_avg:long_name = "Daily sea surface temperature" ;
S_avg:units = "degrees C" ;
S_avg:_FillValue_original = -999s ;
S_avg:valid_min = -300s ;
S_avg:valid_max = 4500s ;
S_avg:_FillValue = -999.f ;
S_avg:average_op_ncl = "dim_avg_n over dimension(s): time" ;
float I_avg(zlev, zlev, lat, lon) ;
I_avg:long_name = "Sea ice concentration" ;
I_avg:units = "percentage" ;
I_avg:_FillValue_original = -999s ;
I_avg:valid_min = 0s ;
I_avg:valid_max = 100s ;
I_avg:_FillValue = -999.f ;
I_avg:average_op_ncl = "dim_avg_n over dimension(s): time" ;
I need 1st dimension to be time. How come it puts zlev and then lev again? I didn't ask for that.
In my opinion, the error has to be in arrays or in averaging.
My code is attached.
-- regards ******************************************************* Alexander Semenov PhD Student - Research Assistant International Arctic Research Center Department of atmospheric sciences University of Alaska Fairbanks 930 Koyukuk dr, 408c3 Fairbanks, AK, USA, 99775 work phone +19074742672
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Mar 13 14:48:14 2012
This archive was generated by hypermail 2.1.8 : Tue Mar 20 2012 - 15:27:15 MDT