Hi Dave,
Thanks for sharing this with me! I'll check the data types.
Yeah the new subroutines I made to create netCDF file are fortran 90. But
most of the original model codes (CMAQ) are fortran 77. I just found if I
call nc_chk1_putvar in an outside subroutine, I can get the correct
magnitude.. It's a bit tricky for me... Anyway, I'll solve it.
Have a good weekend!
Hongyan
On Fri, Jul 31, 2009 at 2:56 PM, Dave Allured <dave.allured@xxxxxxxx> wrote:
> Hongyan,
>
> Those wrong data values are symptomatic of a data type error in a
> subroutine call. For example, passing an integer array in a subroutine
> argument that is supposed to be real or double precision. Please check the
> subroutine and function calls carefully for type mismatches.
>
> I see that you are using the Netcdf fortran 90 interface. If you convert
> your own programs to fortran 90, and use module interfaces, then the
> compiler will find these mistakes for you. I strongly recommend that you
> start using fortran 90 instead of fortran 77. Either way, good luck.
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
> http://www.cdc.noaa.gov/psd1/
>
> H.Dang wrote:
>
>> Hello~
>>
>> The data I got in the netCDF file seems wrong. My code is:
>>
>> nstep_nreps = nstep_nreps + 1
>> DO S = 1, N_GC_SPC
>> call nc_chk1_putvar(
>> & jdate, jtime
>> & , conc_varid(s)
>> & , CGRID, S
>> & , nstep_nreps )
>> END DO write(56,*) 'cgrid(1,1,1,1)',cgrid(1,1,1,1)
>>
>> I checked the first of the data values, in the 56th file, it's corrct:
>> "cgrid(1,1,1,1)=1.6699868E-04".
>> But in the netCDF file, it is: 2.802597e-45. Actually all values in
>> netCDF has magnitude e-19~e-45.
>> The subroutine "nc_chk1_putvar" is like this:
>>
>> count = (/NCOLS, NROWS, NLAYS, 1, 1/)
>> start = (/ 1, 1, 1, Nspecies, nstep_nreps/) call
>> nc_check(nf90_put_var( &
>> chk_ncid, &
>> nc_data_varid, &
>> CGRID(:,:,:,Nspecies), &
>> start=start, &
>> count=count &
>> ))
>>
>> Could you please find apparent mistake in my code? Thank you!
>>
>> --
>> Cordially,
>> Hongyan
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> netcdfgroup mailing list
>> netcdfgroup@xxxxxxxxxxxxxxxx
>> For list information or to unsubscribe, visit:
>> http://www.unidata.ucar.edu/mailing_lists/
>>
>
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
--
Cordially,
Hongyan