Re: How to find the Relative humidity if we take only 4 pressure levels?

From: Manaswini Sreekar <manaswinikolluru_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 25 2011 - 11:04:47 MST

Thanks a lot.

On Fri, Nov 25, 2011 at 8:30 PM, Dennis Shea <shea@ucar.edu> wrote:

> The values are 'wrong' because ....
>
> While you printed out the variable overview (printVarSummary),
> you did not look at what you printed (ie, variable structure).
> The variable consists of spherical harmonic complex coefficients.
> Note the "real_imaginary" dimension of size 2 [real and complex].
>
>
> > initial_time0_hours = 31 ;
> > lv_ISBL1 = 4 ;
> > real_imaginary = 2 ; <=== complex coefficients
> > g50_lat_3 = 800 ; <=== size of complex coef array
> > g50_lon_4 = 800 ;
> [snip]
>
> > float R_GDS50_ISBL(initial_time0_**hours, lv_ISBL1, real_imaginary,
> g50_lat_3, g50_lon_4)
>
> Before using any variable with a "real_imaginary" dimension,
> the coefficients must be used to reconstruct ['synthesize']
> the original variable.
>
> ===
> Somebody used 'ncl_convert2nc' because the file attribute says
> title = "NCL: convert-GRIB-to-netCDF
>
> If using NCL, there is no need to perform this conversion.
> The grib file can be used directly in addfile.
> ===
>
> ALso ... I do not know what you are using for weights
> but they should be layer thickness. See:
>
> http://www.ncl.ucar.edu/**Document/Functions/Built-in/**dpres_plevel.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/dpres_plevel.shtml>
> The bottom should be sfc pressure but you do not gave it on the file.
>
> ptop thickness weight (dp)
> (700-ptop)
> 700
> 750
> 800 75
> 825
> 850 50
> 875
> 900 (pbot-875)
>
> pbot
>
> Also, the vertical average is
>
> rh_dp = dim_sum_wgt_n(RH,dp,0,1)/sum(**dp) ; SUM(RH*dp)/SUM(dp)
>
>
> ==============================**=========================
> The attached may work. I do not have your file so you may have to change
> the code.
>
> It is YOUR responsibility to read the documentation
> of all of the functions used;
> use print statements and **look** at the output.
>
> Good luck
>
>
> On 11/23/11 10:47 PM, Manaswini Sreekar wrote:
>
>> Hi
>>
>> I am new to NCL.
>>
>> Is there anyone who can provide the hint to calculate the Weighted
>> average of relative humidity?
>>
>> I am getting the errors as
>>
>> fatal:dim_avg_wgt_n: w must be length nx
>> fatal:Execute: Error occurred at or near line 15 in file CFRHC.ncl
>>
>> The min and max values for relative humidity are min(RH)=-20.4056
>> max(RH)=213.099.
>>
>> Are these values are correct or wrong?
>>
>>
>>
>> The Print VarSummary
>>
>> Variable: RH_TL_AVG
>> Type: float
>> Total Size: 317440000 bytes
>> 79360000 values
>> Number of Dimensions: 4
>> Dimensions and sizes: [g50_lat_3 | 800] x [g50_lon_4 | 800] x
>> [initial_time0_hours | 31] x [lv_ISBL1 | 4]
>> Coordinates:
>> initial_time0_hours: [1827654..1828374]
>> lv_ISBL1: [700..900]
>> Number Of Attributes: 10
>> center : European Center for Medium-Range Weather Forecasts (RSMC)
>> long_name : Relative humidity
>> units : %
>> _FillValue : 1e+20
>> level_indicator : 100
>> gds_grid_type : 50
>> parameter_table_version : 128
>> parameter_number : 157
>> forecast_time : 0
>> forecast_time_units : hours
>>
>> The net CDF file
>>
>> manaswini@nature:~/Desktop$ ncdump -c RH.nc
>> netcdf RH {
>> dimensions:
>> initial_time0_hours = 31 ;
>> lv_ISBL1 = 4 ;
>> real_imaginary = 2 ;
>> g50_lat_3 = 800 ;
>> g50_lon_4 = 800 ;
>> ncl_strlen_0 = 18 ;
>> variables:
>> char initial_time0(initial_time0_**hours, ncl_strlen_0) ;
>> initial_time0:NCL_converted_**from_type = "string" ;
>> initial_time0:units = "mm/dd/yyyy (hh:mm)" ;
>> initial_time0:long_name = "Initial time of first record" ;
>> int lv_ISBL1(lv_ISBL1) ;
>> lv_ISBL1:units = "hPa" ;
>> lv_ISBL1:long_name = "isobaric level" ;
>> double initial_time0_encoded(initial_**time0_hours) ;
>> initial_time0_encoded:units = "yyyymmddhh.hh_frac" ;
>> initial_time0_encoded:long_**name = "initial time encoded as
>> double" ;
>> double initial_time0_hours(initial_**time0_hours) ;
>> initial_time0_hours:units = "hours since 1800-01-01 00:00" ;
>> initial_time0_hours:long_name = "initial time" ;
>> float R_GDS50_ISBL(initial_time0_**hours, lv_ISBL1, real_imaginary,
>> g50_lat_3, g50_lon_4) ;
>> R_GDS50_ISBL:forecast_time_**units = "hours" ;
>> R_GDS50_ISBL:forecast_time = 0 ;
>> R_GDS50_ISBL:parameter_number = 157 ;
>> R_GDS50_ISBL:parameter_table_**version = 128 ;
>> R_GDS50_ISBL:gds_grid_type = 50 ;
>> R_GDS50_ISBL:level_indicator = 100 ;
>> R_GDS50_ISBL:_FillValue = 1.e+20f ;
>> R_GDS50_ISBL:units = "%" ;
>> R_GDS50_ISBL:long_name = "Relative humidity" ;
>> R_GDS50_ISBL:center = "European Center for Medium-Range Weather
>> Forecasts (RSMC)" ;
>>
>> // global attributes:
>> :creation_date = "Mon Nov 21 17:44:39 IST 2011" ;
>> :NCL_Version = "6.0.0-beta" ;
>> :system = "Linux nature 2.6.31-23-generic #75-Ubuntu SMP Fri
>> Mar 18 18:16:06 UTC 2011 x86_64 GNU/Linux" ;
>> :conventions = "None" ;
>> :grib_source = "RH.grib" ;
>> :title = "NCL: convert-GRIB-to-netCDF" ;
>> data:
>>
>> lv_ISBL1 = 700, 800, 850, 900 ;
>>
>> initial_time0_hours = 1827654, 1827678, 1827702, 1827726, 1827750,
>> 1827774,
>> 1827798, 1827822, 1827846, 1827870, 1827894, 1827918, 1827942,
>> 1827966,
>> 1827990, 1828014, 1828038, 1828062, 1828086, 1828110, 1828134,
>> 1828158,
>> 1828182, 1828206, 1828230, 1828254, 1828278, 1828302, 1828326,
>> 1828350,
>> 1828374 ;
>> }
>> manaswini@nature:~/Desktop$ ^C
>>
>>
>>
>>
>>
>> ______________________________**_________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/**mailman/listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>

-- 
manu

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 25 11:04:57 2011

This archive was generated by hypermail 2.1.8 : Wed Nov 30 2011 - 19:52:47 MST