[ncl-talk] Y axis ticks
Kevin Hallock
hallock at ucar.edu
Thu Jun 28 13:38:09 MDT 2018
Hi Soma,
You’re welcome!
Sometimes debugging a script involves trial and error, but in this case I just happened to notice that your script used two different time arrays for time_axis_labels and gsn_csm_hov, while all of the examples on the time_axis_labels documentation page <https://www.ncl.ucar.edu/Document/Functions/User_contributed/time_axis_labels.shtml> use the same time dimension for both time_axis_labels and whichever gsn_csm_* function it calls.
Regarding the other small mistake you mentioned: the version of the script that you provided in your original email only has 77 lines, so I’d need an updated version of the script to help with the issue on line 85.
Kevin
> On Jun 28, 2018, at 12:23 PM, Soma Roy <somaroy892 at gmail.com> wrote:
>
> Awesome, thanks!
>
> It worked. But is this process is just to check by trail and error?
>
> I did a small mistake at line no 85.
>
> Thank you again.
>
> Soma
>
> On Thu, Jun 28, 2018, 23:47 Kevin Hallock <hallock at ucar.edu <mailto:hallock at ucar.edu>> wrote:
> Hi Soma,
>
> Thanks for sharing your file.
>
> I was able to clean up the Y-axis labels by replacing:
> restick at ttmMajorStride = 25
> time_axis_labels(ts&time,res,restick)
>
> with:
> restick at ttmMajorStride = 7
> time_axis_labels(xDay&time,res,restick)
>
> You can modify the interval between major tick marks as needed.
>
> Kevin
>
>> On Jun 28, 2018, at 11:56 AM, Soma Roy <somaroy892 at gmail.com <mailto:somaroy892 at gmail.com>> wrote:
>>
>>
>> spatial_leh.nc <https://drive.google.com/file/d/1Qa144nlu5gSNitlM6i5YT0F8_bZa-Wme/view?usp=drive_web>Sending you the sample file here as I am unable to put it in ftp.
>>
>> Soma
>>
>> On Thu, Jun 28, 2018 at 10:54 PM, Kevin Hallock <hallock at ucar.edu <mailto:hallock at ucar.edu>> wrote:
>> Hi Soma,
>>
>> It’s hard to determine exactly what the problem is without a copy of your data file to test the script myself, but I suspect there may be something odd happening with the time_axis_labels and gsn_csm_hov calls:
>> time_axis_labels(ts&time,res,restick)
>> plot = gsn_csm_hov(wks,xDay(:,:,{78}),res) ; lat vs time.
>>
>> In particular, I noticed that the time dimensions on the variables ts and xDay are different sizes (248 for ts, 31 for xDay). You may want to try using xDay&time in your time_axis_labels call, although you might also need to adjust the value of restick at ttmMajorStride to account for the smaller time dimension on xDay.
>>
>> If you are still having trouble generating correct Y-axis labels after trying this, would you perhaps be able to provide us with a copy of your data file? (See uploading instructions: https://www.ncl.ucar.edu/ftp_files.shtml <https://www.ncl.ucar.edu/ftp_files.shtml>)
>>
>> I hope this helps,
>> Kevin
>>
>>> On Jun 28, 2018, at 10:26 AM, Soma Roy <somaroy892 at gmail.com <mailto:somaroy892 at gmail.com>> wrote:
>>>
>>> Hello,
>>>
>>> I am trying to calculate daily mean values from daily 4 time steps and plot a date vs latitude plot.
>>>
>>> Date on Y-axis is not coming clearly.
>>>
>>> PrintVarSummary of the data is as follows;
>>>
>>> Variable: tem
>>> Type: float
>>> Total Size: 6416172 bytes
>>> 1604043 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 123] x [latitude | 161] x [longitude | 81]
>>> Coordinates:
>>> time: [969336..970068]
>>> latitude: [ 0..40]
>>> longitude: [65..85]
>>> Number Of Attributes: 6
>>> missing_value : -32767
>>> missing_value_original : -32767
>>> _FillValue : -32767
>>> _FillValue_original : -32767
>>> long_name : 2 metre temperature
>>> units : K
>>>
>>> Variable: cd_date
>>> Type: double
>>> Total Size: 1992 bytes
>>> 249 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes: [249]
>>> Coordinates:
>>> Number Of Attributes: 2
>>> units : days since 1990-01-01 00:00:00
>>> calendar : gregorian
>>>
>>>
>>> Variable: cd_date
>>> Type: double
>>> Total Size: 1992 bytes
>>> 249 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes: [249]
>>> Coordinates:
>>> Number Of Attributes: 2
>>> units : days since 1990-01-01 00:00:00
>>> calendar : gregorian
>>> (0) 2010080100
>>> (1) 2010080106
>>> (2) 2010080112
>>> (3) 2010080118
>>> (4) 2010080200
>>> (5) 2010080206
>>> (6) 2010080212
>>> (7) 2010080218
>>> ........................................
>>> (120) 2010083100
>>> (121) 2010083106
>>> (122) 2010083112
>>> (123) 2010083118
>>>
>>> (124) 2010080103
>>> (125) 2010080109
>>> (126) 2010080115
>>> (127) 2010080121
>>> (128) 2010080203
>>> (129) 2010080209
>>> .........................................
>>> (244) 2010083103
>>> (245) 2010083109
>>> (246) 2010083115
>>> (247) 2010083121
>>> (248) 2010090100
>>>
>>> Variable: temp
>>> Type: float
>>> Total Size: 12988836 bytes
>>> 3247209 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 249] x [latitude | 161] x [longitude | 81]
>>> Coordinates:
>>> time: [969336..970080]
>>> latitude: [ 0..40]
>>> longitude: [65..85]
>>> Number Of Attributes: 6
>>> units : K
>>> long_name : 2 metre temperature
>>> _FillValue_original : -32767
>>> _FillValue : -32767
>>> missing_value_original : -32767
>>> missing_value : -32767
>>>
>>> Variable: ts1
>>> Type: short
>>> Total Size: 6468336 bytes
>>> 3234168 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 248] x [latitude | 161] x [longitude | 81]
>>> Coordinates:
>>> time: [969336..970077]
>>> latitude: [ 0..40]
>>> longitude: [65..85]
>>> Number Of Attributes: 6
>>> scale_factor : 0.0008040587614255413
>>> add_offset : 289.9817757049943
>>> _FillValue : -32767
>>> missing_value : -32767
>>> units : K
>>> long_name : 2 metre temperature
>>>
>>> Variable: ts
>>> Type: float
>>> Total Size: 12936672 bytes
>>> 3234168 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 248] x [latitude | 161] x [longitude | 81]
>>> Coordinates:
>>> time: [969336..970077]
>>> latitude: [ 0..40]
>>> longitude: [65..85]
>>> Number Of Attributes: 1
>>> _FillValue : -32767
>>>
>>> Variable: tim
>>> Type: integer
>>> Total Size: 996 bytes
>>> 249 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes: [time | 249]
>>> Coordinates:
>>> time: [969336..970080]
>>> Number Of Attributes: 3
>>> units : hours since 1900-01-01 00:00:0.0
>>> long_name : time
>>> calendar : gregorian
>>>
>>> Variable: xDay
>>> Type: float
>>> Total Size: 1617084 bytes
>>> 404271 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 31] x [latitude | 161] x [longitude | 81]
>>> Coordinates:
>>> time: [969336..970056]
>>> latitude: [ 0..40]
>>> longitude: [65..85]
>>> Number Of Attributes: 8
>>> _FillValue : -32767
>>> missing_value : -32767
>>> missing_value_original : -32767
>>> _FillValue_original : -32767
>>> long_name : 2 metre temperature
>>> units : K
>>> time : 969336
>>> NCL_tag : calculate_daily_values: arith=avg
>>>
>>> Output figure file and script are attached below.
>>>
>>> Kindly inform me how to fix it.
>>>
>>> Thanks,
>>> Soma
>>>
>>>
>>> <time_lat.png><test.ncl>_______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180628/303cfdc4/attachment.html>
More information about the ncl-talk
mailing list