Not able to use modified WRF files with wrf-python (wrf.getvar)

435 views
Skip to first unread message

tr...@ucar.edu

unread,
Jun 17, 2020, 2:40:48 PM6/17/20
to wrfpython-talk
I have some modified WRF files that I am trying to use with wrf-python. However, I get this error message when using dataset:
IndexError: tuple index out of range

and this error while using xarray: 
TypeError: iteration over a 0-d array

This is the ndcump of the file.   I wonder if I am missing an attribute or variable that is needed to use wrf.getvar

netcdf small_wrf2d_d01_CTRL_PREC_ACC_NC_200010-200012 {
dimensions:
	Time = UNLIMITED ; // (2208 currently)
	south_north = 231 ;
	west_east = 301 ;
	DateStrLen = 19 ;
variables:
	float PREC_ACC_NC(Time, south_north, west_east) ;
		PREC_ACC_NC:FieldType = 104 ;
		PREC_ACC_NC:MemoryOrder = "XY " ;
		PREC_ACC_NC:description = "ACCUMULATED GRID SCALE  PRECIPITATION OVER prec_acc_dt PERIODS OF TIME" ;
		PREC_ACC_NC:units = "mm" ;
		PREC_ACC_NC:stagger = "" ;
		PREC_ACC_NC:coordinates = "XLONG XLAT" ;
		PREC_ACC_NC:long_name = "PREC_ACC_NC" ;
	double Time(Time) ;
		Time:units = "hours since 1901-01-01 00:00:00" ;
		Time:calendar = "standard" ;
		Time:long_name = "Time" ;
		Time:description = "Time" ;
	char Times(Time, DateStrLen) ;
		Times:long_name = "Time" ;
		Times:description = "Model output time in yyyy-mm-dd_HH:MM:SS" ;
		Times:units = "1" ;
	float XLAT(south_north, west_east) ;
		XLAT:FieldType = 104 ;
		XLAT:MemoryOrder = "XY " ;
		XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;
		XLAT:units = "degree_north" ;
		XLAT:stagger = "" ;
		XLAT:long_name = "Latitude" ;
	float XLONG(south_north, west_east) ;
		XLONG:FieldType = 104 ;
		XLONG:MemoryOrder = "XY " ;
		XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;
		XLONG:units = "degree_east" ;
		XLONG:stagger = "" ;
		XLONG:long_name = "Longitude" ;
	float XTIME(Time) ;
		XTIME:FieldType = 104 ;
		XTIME:MemoryOrder = "0  " ;
		XTIME:description = "minutes since simulation start" ;
		XTIME:stagger = "" ;
		XTIME:units = "minute" ;
		XTIME:long_name = "XTIME" ;

// global attributes:
		:SIMULATION_START_DATE = "2000-10-01_00:00:00" ;
		:WEST-EAST_GRID_DIMENSION = 1360 ;
		:SOUTH-NORTH_GRID_DIMENSION = 1016 ;
		:BOTTOM-TOP_GRID_DIMENSION = 51 ;
		:DX = 4000.f ;
		:DY = 4000.f ;
		:GRIDTYPE = "C" ;
		:DIFF_OPT = 1 ;
		:KM_OPT = 4 ;
		:DAMP_OPT = 3 ;
		:DAMPCOEF = 0.2f ;
		:KHDIF = 0.f ;
		:KVDIF = 0.f ;
		:MP_PHYSICS = 28 ;
		:RA_LW_PHYSICS = 4 ;
		:RA_SW_PHYSICS = 4 ;
		:SF_SFCLAY_PHYSICS = 11 ;
		:SF_SURFACE_PHYSICS = 4 ;
		:BL_PBL_PHYSICS = 1 ;
		:CU_PHYSICS = 0 ;
		:SURFACE_INPUT_SOURCE = 1 ;
		:SST_UPDATE = 1 ;
		:GRID_FDDA = 2 ;
		:GFDDA_INTERVAL_M = 360 ;
		:GFDDA_END_H = 999999 ;
		:GRID_SFDDA = 0 ;
		:SGFDDA_INTERVAL_M = 0 ;
		:SGFDDA_END_H = 0 ;
		:HYPSOMETRIC_OPT = 2 ;
		:SF_URBAN_PHYSICS = 0 ;
		:SHCU_PHYSICS = 0 ;
		:MFSHCONV = 0 ;
		:FEEDBACK = 0 ;
		:SMOOTH_OPTION = 2 ;
		:SWRAD_SCAT = 1.f ;
		:W_DAMPING = 1 ;
		:MOIST_ADV_OPT = 1 ;
		:SCALAR_ADV_OPT = 1 ;
		:TKE_ADV_OPT = 1 ;
		:DIFF_6TH_OPT = 0 ;
		:DIFF_6TH_FACTOR = 0.12f ;
		:FGDT = 0.f ;
		:GUV = 5.e-05f ;
		:GT = 5.e-05f ;
		:GPH = 5.e-05f ;
		:IF_RAMPING = 1 ;
		:DTRAMP_MIN = 60.f ;
		:OBS_NUDGE_OPT = 0 ;
		:BUCKET_MM = 100.f ;
		:BUCKET_J = 1.e+09f ;
		:PREC_ACC_DT = 60.f ;
		:OMLCALL = 0 ;
		:ISFTCFLX = 0 ;
		:ISHALLOW = 0 ;
		:OPT_SFC = 1 ;
		:DVEG = 4 ;
		:OPT_CRS = 1 ;
		:OPT_BTR = 2 ;
		:OPT_RUN = 1 ;
		:OPT_FRZ = 1 ;
		:OPT_INF = 1 ;
		:OPT_RAD = 3 ;
		:OPT_ALB = 2 ;
		:OPT_SNF = 4 ;
		:OPT_TBOT = 1 ;
		:OPT_STC = 1 ;
		:DFI_OPT = 0 ;
		:WEST-EAST_PATCH_START_UNSTAG = 1 ;
		:WEST-EAST_PATCH_END_UNSTAG = 1359 ;
		:WEST-EAST_PATCH_START_STAG = 1 ;
		:WEST-EAST_PATCH_END_STAG = 1360 ;
		:SOUTH-NORTH_PATCH_START_UNSTAG = 1 ;
		:SOUTH-NORTH_PATCH_END_UNSTAG = 1015 ;
		:SOUTH-NORTH_PATCH_START_STAG = 1 ;
		:SOUTH-NORTH_PATCH_END_STAG = 1016 ;
		:BOTTOM-TOP_PATCH_START_UNSTAG = 1 ;
		:BOTTOM-TOP_PATCH_END_UNSTAG = 50 ;
		:BOTTOM-TOP_PATCH_START_STAG = 1 ;
		:BOTTOM-TOP_PATCH_END_STAG = 51 ;
		:GRID_ID = 1 ;
		:PARENT_ID = 0 ;
		:I_PARENT_START = 1 ;
		:J_PARENT_START = 1 ;
		:PARENT_GRID_RATIO = 1 ;
		:DT = 15.f ;
		:CEN_LAT = 39.70001f ;
		:CEN_LON = -98.f ;
		:TRUELAT1 = 28.f ;
		:TRUELAT2 = 50.f ;
		:MOAD_CEN_LAT = 39.70001f ;
		:STAND_LON = -98.f ;
		:POLE_LAT = 90.f ;
		:POLE_LON = 0.f ;
		:GMT = 0.f ;
		:JULYR = 2000 ;
		:JULDAY = 275 ;
		:MAP_PROJ = 1 ;
		:MMINLU = "MODIFIED_IGBP_MODIS_NOAH" ;
		:NUM_LAND_CAT = 20 ;
		:ISWATER = 17 ;
		:ISLAKE = -1 ;
		:ISICE = 15 ;
		:ISURBAN = 13 ;
		:ISOILWATER = 14 ;
		:Source_Code = "make_HYDRO_CONUS_analysis_files.scr" ;
		:FileGenerated = "20140813" ;
		:Project = "CONUS-HYDRO" ;
		:Division = "NCAR/RAL/HAP" ;
		:history = "Tue Jun  9 16:07:12 2020: ncrcat -O -d west_east,0,300 -d south_north,700,930 /glade/collections/rda/data/ds612.0/CTRL/2000/wrf2d_d01_CTRL_PREC_ACC_NC_200010-200012.nc CONUS_2D/2000/small_wrf2d_d01_CTRL_PREC_ACC_NC_200010-200012.nc\nTue Jan 17 13:44:04 2017: ncks -O -4 /glade/scratch/kyoko/CONUS/RDA/CTRL/2000/wrf2d_d01_CTRL_PREC_ACC_NC_20001001.nc /glade/scratch/kyoko/CONUS/RDA/CTRL/2000/wrf2d_d01_CTRL_PREC_ACC_NC_20001001.nc\nWed Aug 13 07:43:34 2014: ncks -O -4 -L 1 /glade/scratch/kyoko/CONUS/CTRL/2000/wrf2d_d01_2000-10-01_00:00:00 /glade/scratch/kyoko/CONUS/CTRL/2000/wrf2d_d01_2000-10-01_00:00:00" ;
		:NCO = "netCDF Operators version 4.7.9 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)" ;
		:Publication_DOI = "doi:10.1007/s00382-016-3327-9" ;
		:Conventions = "CF-1.6" ;
		:TITLE = " OUTPUT FROM WRF V3.4.1 MODEL , CURRENT CLIMATE SIMULATION" ;
}


Swati Singh

unread,
Aug 24, 2021, 2:20:09 AM8/24/21
to wrfpython-talk, Trude Eidhammer
Dear Trude,
I am also facing the similar problem with wrf.getvar. I searched for the solution, but not did not get success. Could you please let me know how did you resolve it?
With Regards
Swati

Trude Eidhammer

unread,
Aug 24, 2021, 2:37:17 PM8/24/21
to Swati Singh, wrfpython-talk
Hi Swati

I did not find a solution to this problem.

-- Trude
--
Dr. Trude Eidhammer
Project Scientist II
Research Applications Laboratory (RAL)
National Center for Atmospheric Research (NCAR)
P.O. Box 3000
Boulder, CO 80307-3000, USA 

Luca

unread,
Jul 14, 2022, 1:58:55 PM7/14/22
to wrfpython-talk, tr...@ucar.edu, wrfpython-talk, swati...@univ-reunion.fr
Hi all, same problem here , I'm trying to find a solution.



Luca

Marco Miani

unread,
Sep 1, 2022, 4:18:47 AM9/1/22
to wrfpython-talk, tr...@ucar.edu, wrfpython-talk, swati...@univ-reunion.fr
Hi Trude.

Any chance you could share the file in question? Maybe just 1 timestep (out of the 2208)?
 
-Marco
Reply all
Reply to author
Forward
0 new messages