Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Error with generating atmospheric forcing for a single point simulation

sandeepc

Sandeep Chinta
New Member
Dear Scientist,

I am trying to run a single point simulation test case from the tutorial https://www.cgd.ucar.edu/events/2019/ctsm/files/practical4-wieder.pdf (Slides 17-20).

I am able to create the domain, surface and landuse data. However, when I try to generate the forcing data (create_datm = True), I am getting the following error.

(py2) [sandeepc@svante-login contrib]$ ./singlept-py27
singlept script to extract out a single point from the global CTSM inputdata datasets

User = sandeepc
Current directory = /net/fs05/d1/sandeepc/cesm21/my_cesm_sandbox/components/clm/tools/contrib

Open: /net/fs05/d1/cesm2/inputdata/share/domains/domain.lnd.fv0.9x1.25_gx1v7.151020.nc
./singlept-py27:173: FutureWarning: The inplace argument has been deprecated and will be removed in xarray 0.12.0.
f2.reset_coords(['xc','yc'],inplace=True)
created file /home/sandeepc/fs05/d1/sandeepc/cesm21/my_cesm_sandbox/components/clm/tools/spdata_1atm/domain.lnd.fv0.9x1.25_gx1v7_287.8_42.5.151020.nc
Open: /net/fs05/d1/cesm2/inputdata/lnd/clm2/surfdata_map/release-clm5.0.18/surfdata_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850_c190214.nc
created file /home/sandeepc/fs05/d1/sandeepc/cesm21/my_cesm_sandbox/components/clm/tools/spdata_1atm/surfdata_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850_287.8_42.5_c190214.nc
Open: /net/fs05/d1/cesm2/inputdata/lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc
created file /home/sandeepc/fs05/d1/sandeepc/cesm21/my_cesm_sandbox/components/clm/tools/spdata_1atm/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_287.8_42.5_c170824.nc
Open: /net/fs05/d1/cesm2/inputdata/atm/datm7/atm_forcing.datm7.GSWP3.0.5d.v1.c170516/domain.lnd.360x720_gswp3.0v1.c170606.nc
./singlept-py27:301: FutureWarning: The inplace argument has been deprecated and will be removed in xarray 0.12.0.
f2.reset_coords(['xc','yc'],inplace=True)
created file /home/sandeepc/fs05/d1/sandeepc/cesm21/my_cesm_sandbox/components/clm/tools/spdata_1atm/datmdata/domain.lnd.360x720_gswp3.0v1_287.8_42.5.c170606.nc
/home/sandeepc/fs05/d1/sandeepc/cesm21/my_cesm_sandbox/components/clm/tools/spdata_1atm/datmdata/clmforc.GSWP3.c2011.0.5x0.5.Solr.287.8_42.5.1901-01.nc

./singlept-py27:360: FutureWarning: The inplace argument has been deprecated and will be removed in xarray 0.12.0.
f2.reset_coords(['LONGXY','LATIXY'],inplace=True)
Traceback (most recent call last):
File "./singlept-py27", line 368, in <module>
f3.to_netcdf(path=file_out, mode='w')
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/core/dataset.py", line 1232, in to_netcdf
compute=compute)
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/backends/api.py", line 747, in to_netcdf
unlimited_dims=unlimited_dims)
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/backends/api.py", line 790, in dump_to_store
unlimited_dims=unlimited_dims)
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/backends/common.py", line 261, in store
variables, attributes = self.encode(variables, attributes)
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/backends/common.py", line 347, in encode
variables, attributes = cf_encoder(variables, attributes)
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/conventions.py", line 605, in cf_encoder
for k, v in iteritems(variables))
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/collections.py", line 69, in __init__
self.__update(*args, **kwds)
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/_abcoll.py", line 571, in update
for key, value in other:
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/conventions.py", line 605, in <genexpr>
for k, v in iteritems(variables))
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/conventions.py", line 238, in encode_cf_variable
var = maybe_encode_nonstring_dtype(var, name=name)
File "/home/sandeepc/.conda/envs/py2/lib/python2.7/site-packages/xarray/conventions.py", line 95, in maybe_encode_nonstring_dtype
data = data.astype(dtype=dtype)
TypeError: float() argument must be a string or a number

I have also attached the singlept file. Could you please check?
 

Attachments

  • singlept-py27.txt
    12.9 KB · Views: 4

sandeepc

Sandeep Chinta
New Member
It is working now.

I have commented the line f3.to_netcdf(path=file_out, mode='w').
I have added
import netCDF4 as nc
f3=nc.Dataset(file_out, 'w', format='NETCDF4').

Thank you.
 
Top